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

怎样将radio和text关联啊?非常非常的急。。。谢谢
我做了8个radio,name都是r2,和8个text,name是不同的。
我想点r2的第八个选项的时候,也就是说点other的时候,text8会显示出来,让我们输入内容,如果点其他的radio的时候,text8是显示不出的。
<input   type   =   "radio "   name   =   "R2 "     value   =   " "> Other
<input   type   =   "text "   name   =   "t8 "   size   =   "20 ">
大侠们帮帮忙啊,谢谢。


------解决方案--------------------
<input type = "radio " name = "R2 " value = " " onclick= "displayInput( 'none ') "> R2
<input type = "radio " name = "R2 " value = " " onclick= "displayInput( ' ') "> Other
<input type = "text " name = "t8 " id= "t81 " size = "20 " style= "display:none ">

<script language= "javascript ">
function displayInput(display)
{
document.getElementById( "t81 ").style.display = display;
}
</script>
------解决方案--------------------
<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( ' ') "/> <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>

------解决方案--------------------
<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 &