Entry
How to make a check box enable or disable a group of radio buttons on a form?
May 29th, 2003 11:59
colleen stephan, Ade Taiwo,
<body>
<form name="form1">
<input type=checkbox name=toggle onClick="disableRadioGroup(Option2,
(this.value.length == 0))">
<input type="radio" name="Option2" value="2a" >
<input type="radio" name="Option2" value="2b" >
</form>
</body>
<script type="text/javascript">
<!--
function disableRadioGroup(radioGroup, disable)
{
if(document.forms["form1"].elements["toggle"].checked){
for(var i=0; i < radioGroup.length; i++)
{
radioGroup[i].disabled = false
}
}
else
{
for(var i=0; i < radioGroup.length; i++)
{
radioGroup[i].disabled = true
}
}
}
//-->
</script>