Disable Checkbox

[Total: 0    Average: 0/5]

This shows how to disable a checkbox selection based upon a radio button selection.

Body Code:

<form name=exf1>
1<input type="checkbox" name="c1" value="check me1" onclick="change(1)"><BR>
2<input type="checkbox" name="c2" value="check me2" onclick="change(2)"><BR>
3<input type="checkbox" name="c3" value="check me3" onclick="change(3)"><BR>
4<input type="checkbox" name="c4" value="check me4" onclick="change(4)"><BR>
5<input type="checkbox" name="c5" value="check me5" onclick="change(5)"><BR>
Disabled: Yes<input type="radio" name="dis" value="1" onclick="document.exf1.disabled.value=1">
           No<input type="radio" name="dis" value="0" onclick="document.exf1.disabled.value=0" checked><BR>
<input type=hidden name=disabled value=0>
function change(_i) {
  if (document.exf1.disabled.value==0) return;
  eval("document.exf1.c"+_i+".checked = ! document.exf1.c"+_i+".checked");

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *