Disable Radio Buttons

[Total: 0    Average: 0/5]

This example shows how to diable radio buttons with another radio button.

Body Code:

<form Name="exf1">
Buttons [A<input type=radio name=r1 value=A onclick="if(isDis()){return false;}">
         B<input type=radio name=r1 value=B onclick="if(isDis()){return false;}">]
		[C<input type=radio name=r2 value=C onclick="if(isDis()){return false;}">
         D<input type=radio name=r2 value=D onclick="if(isDis()){return false;}">]
		[E<input type=radio name=r3 value=E onclick="if(isDis()){return false;}">
         F<input type=radio name=r3 value=F onclick="if(isDis()){return false;}">]<BR>
On  <input type=radio value="Toggle Disable" checked onclick="lockIt(_F)" id=radio1 name=radio1>
Off <input type=radio value="Toggle Disable" onclick="lockIt(_T)" id=radio1 name=radio1>
<input type=hidden name="lck" value="unlocked"> 
</form> 

<script Language="JavaScript"> 

var _T = "locked";
var _F = "unlocked";
function lockIt(_P) 
 {
   var _L = document.exf1.lck.value;
   if(_L==_P)return;
   document.exf1.r1.disabled=
   document.exf1.r2.disabled=
   document.exf1.r3.disabled=
     ((document.exf1.lck.value=(_L==_F)?_T:_F)==_T);
   alert(document.exf1.r2.disabled);
}

function isDis() { 
  return (document.exf1.lck.value==_T); 
}

</script>

Times Viewed: 0

Leave a Reply

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