-
(RESOLVED) Checkboxes
I've got a simple form with a check box and a few fields, when I click on the check box I want it to alter the background of a textbox, which I can do, but when I uncheck it the colour doesn't revert. Help it doesnt seem to fire the else statement
function SetDate()
{
document.form1.enddate.value=document.form1.startdate.value;
}
function SetColor()
{
if(document.all.bkacccode.checked=true)
{
document.all.bkacccode.style.backgroundColor='#FFE6E6';
}
else
{
document.all.bkacccode.style.backgroundColor='#FFFFFF';
}
}
I use onClick for the checkbox
-
Hi
<form>
<input type="text" name="a">
<input type="checkbox" onclick="this.form.a.style.backgroundColor= (checked) ? '#FFE6E6':'#FFFFFF'">
</form>
Vinny
-
Great thanks, worked perfect.