Entry
How can I use a check box to toggle an input field between readonly(grey bg color) and editable?
Aug 21st, 2005 10:23
Javier Chapa, Arsen Yeremin, Mihir Shah,
<html>
<head>
<title>CheckMe</title>
</head>
<body>
<form>
<p style="line-height: half">
<input type="checkbox" onclick=GrayOut(this)>
Utility Check </p>
<p style="line-height: none">
<font size="2"> City
of : </font>
<input type="text" name="first_name" value="" disabled="disabled"
size="20" style="padding: 0"><font size="2">
</font> </p>
<p style="line-height: "1"> </p>
<p> <! <input type="text" name="first_name"
value="Arsen">
</p>
</form>
<script>
function GrayOut(obj_checkbox)
{
if(obj_checkbox.checked)
{
obj_checkbox.form.first_name.disabled = false;
}
else
{
obj_checkbox.form.first_name.disabled = true;
}
}
</script>