Radio Button – Lock

[Total: 0    Average: 0/5]

This allows the user via javascript to lock the radio button at its current value until the user unlocks it again.

Body Code:

<script type=text/javascript>
var _value="1";
var _latched = false;
function latch() {

function unlock() {
function setIt(_i) {
  if (!_latched) {
    _value = _i.toString();
  } else {
    document.ef1.r1[0].checked=(_value == "1");
    document.ef1.r1[1].checked=(_value == "2");
    document.ef1.r1[2].checked=(_value == "3");

<form name=ef1>
1 <input name="r1" type="radio" value="a" checked onclick="setIt(1)"><BR>
2 <input name="r1" type="radio" value="b" onclick="setIt(2)"><BR>
3 <input name="r1" type="radio" value="c" onclick="setIt(3)"><BR>
Locked: <input name="r2" type="radio" value="Locked" onclick="latch()"><BR>
Not Locked: <input name="r2" type="radio" value="UnLocked" onclick="unlock()"><BR>
Button Value Checked: <input name="t1" type="text" value="1">

Times Viewed: 5

Leave a Reply

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