HI Gurus,
I have created a simple function that enables a text field if a check box is ticked. (and vice versa)
Here is the code ...
<input name = "vm_box" type = "checkbox" onClick="enableField('vm_pin', 'vm_box')" />
<input name = "vm_pin" type = "text" maxlength = "5" disabled />
function enableField(text_id, vm_box_id)
{
var a = document.getElementById(vm_box_id);
var e = document.getElementById(text_id);
if (a.checked)
{
e.disabled=false;
e.focus();
}
else
{
e.disabled=true;
e.value = "";
}
}
It works fine in MS IE but not in firefox. I have tried changing it but I cannot get it to work in BOTH browsers.
Does anyone have any ideas ?
regards,
Steven Matthews
I have created a simple function that enables a text field if a check box is ticked. (and vice versa)
Here is the code ...
<input name = "vm_box" type = "checkbox" onClick="enableField('vm_pin', 'vm_box')" />
<input name = "vm_pin" type = "text" maxlength = "5" disabled />
function enableField(text_id, vm_box_id)
{
var a = document.getElementById(vm_box_id);
var e = document.getElementById(text_id);
if (a.checked)
{
e.disabled=false;
e.focus();
}
else
{
e.disabled=true;
e.value = "";
}
}
It works fine in MS IE but not in firefox. I have tried changing it but I cannot get it to work in BOTH browsers.
Does anyone have any ideas ?
regards,
Steven Matthews