日期:2014-05-17  浏览次数:20865 次

关于radio和text关联,代码我贴出来了,可是有点问题,麻烦高手帮我看看。谢谢
<html>
<head>
<title> 示例 </title>
<script   language= "javascript ">
function   showInput(display)
{
    document.getElementById( "text8 ").style.display=display;
}
</script>
</head>

<body>
<form   id= "form1 "   name= "form1 "   method= "post "   action= " ">
    <input   type= "radio "   name= "radiobutton "   value= "1 "   />
    <input   type= "radio "   name= "radiobutton "   value= "2 "   />
    <input   type= "radio "   name= "radiobutton "   value= "3 "   />
    <input   type= "radio "   name= "radiobutton "   value= "4 "   />
    <input   type= "radio "   name= "radiobutton "   value= "5 "   />
    <input   type= "radio "   name= "radiobutton "   value= "6 "   />
    <input   type= "radio "   name= "radiobutton "   value= "7 "   />

    <input   type= "radio "   name= "radiobutton "   value= "8 "   onclick= "showInput( ' ') "   onblur= "showInput( 'none ') "/> <br/>

    <input   type= "text "   name= "text1 "   />
    <input   type= "text "   name= "text2 "   />
    <input   type= "text "   name= "text3 "   />
    <input   type= "text "   name= "text4 "   />
    <input   type= "text "   name= "text5 "   />
    <input   type= "text "   name= "text6 "   />
    <input   type= "text "   name= "text7 "   />
    <input   type= "text "   name= "text8 "   id= "text8 "   style= "display:none "/>
</form>
</body>
</html>


我点radio8的时候,text8能跳出来,可是不能在文本框中输入内容。点一下文本框准备输入字的时候文本框不见了。我想点radio8的时候,能够输入文字,不点radio8的时候文本框消失,麻烦大家帮我看下代码,谢谢


------解决方案--------------------
那时因为我没给其它的radio加上onclick= "showInput() " ,你加上后就可以了