日期:2014-05-16  浏览次数:20324 次

求救单选框问题
利用单选框控制单选框。例如A、B。C、D两组单选按扭,我选择了A   则C、D可以选择。如果选择了B则C、D变灰。

------解决方案--------------------
<script type= "text/javascript ">
function EnableCD(blnEnable)
{

var rdoCDs = document.getElementsByName( "CD ");
for(var i = 0; i < rdoCDs.length; i++)
{
rdoCDs[i].disabled = !blnEnable;
}
}
</script>
<input type= "radio " name= "controlCD " value= "A " onclick= "EnableCD(true); " /> A
<input type= "radio " name= "controlCD " value= "B " onclick= "EnableCD(false); " /> B
<br />
<input type= "radio " name= "CD " value= "C " /> C
<input type= "radio " name= "CD " value= "D " /> D

这样行吗?