单选按钮的问题!怎么才能实现 没点中为灰色 选中的可以写东西拿??????
下面这段代码中,我点中radio1时只操作文本rq1内容,其他为灰色不允许操作,点中radio2时只操作文本rq2内容,其他为灰色不允许操作。。。。。。。。
代码如下:
<table>
<tr>
<td> <input name= "radio1 " type= "radio " value= "1 "> </td> <td> <input name= "rq1 " type= "text "> </td>
</tr>
<tr>
<td> <input name= "radio2 " type= "radio " value= "2 "> </td> <td> <input name= "rq2 " type= "text "> </td>
</tr>
<tr>
<td> <input name= "radio3 " type= "radio " value= "3 "> </td> <td> <input name= "rq3 " type= "text "> </td>
</tr>
<tr>
<td> <input name= "radio4 " type= "radio " value= "4 "> </td> <td> <input name= "rq4 " type= "text "> </td>
</tr>
</table>
------解决方案--------------------onclick的时候用js做radiobutton的disable
------解决方案-------------------- <html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 新建网页 1 </title>
<script language= "javascript ">
function enable(elementName){
alert(elementName);
document.all(elementName).disabled=false;
alert(document.all( "rq1 ").disabled);
//document.all(elementName).focus();
}
</script>
</head>
<body>
<table>
<tr>
<td> <input name= "radio1 " type= "radio " value= "1 " onclick= "enable( 'rq1 ') "> </td> <td> <input name= "rq1 " type= "text " disabled> </td>
</tr>
<tr>
<td> <input name= "radio1 " type= "radio " value= "2 " onclick= "enable( 'rq2 ') "> </td> <td> <input name= "rq2 " type= "text " disabled> </td>
</tr>
<tr>
<td> <input name= "radio1 " type= "radio " value= "3 " onclick= "enable( 'rq3 ') "> </td> <td> <input name= "rq3 " type= "text " disabled> </td>
</tr>
<tr>
<td> <input name= "radio1 " type= "radio " value= "4 " onclick= "enable( 'rq4 ') "> </td> <td> <input name= "rq4 " type= "text " disabled> </td>
</tr>
</table>
</body>
</html>