|
-
Feb 21st, 2002, 09:06 AM
#1
Thread Starter
Hyperactive Member
(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
Last edited by parkes; Feb 21st, 2002 at 10:09 AM.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Feb 21st, 2002, 10:03 AM
#2
Member
Hi
<form>
<input type="text" name="a">
<input type="checkbox" onclick="this.form.a.style.backgroundColor= (checked) ? '#FFE6E6':'#FFFFFF'">
</form>
Vinny
-
Feb 21st, 2002, 10:08 AM
#3
Thread Starter
Hyperactive Member
Great thanks, worked perfect.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|