You are here: irt.org | FAQ | JavaScript | DHTML | Q1712 [ previous next ]
The following works in HTMl 4.0 enabled browsers:
<script language="JavaScript"><!-- function disableGroup(formName, groupName, booleanDisabled) { for (var i=0; i<formName.elements.length; i++) { if (formName.elements[i].name == groupName) { formName.elements[i].disabled = booleanDisabled; } } } //--></script> <form> <input type="radio" name="grp1"> <input type="radio" name="grp1"> <input type="radio" name="grp1"> <input type="radio" name="grp1"> <input type="radio" name="grp1"> <input type="button" value="Disable" onClick="disableGroup(this.form, 'grp1', true)"> <input type="button" value="Enable" onClick="disableGroup(this.form, 'grp1', false)"> </form>