Results 1 to 3 of 3

Thread: (RESOLVED) Checkboxes

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Question (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

  2. #2
    Member Vincent Puglia's Avatar
    Join Date
    Feb 2002
    Location
    where the World once stood
    Posts
    36
    Hi

    <form>
    <input type="text" name="a">
    <input type="checkbox" onclick="this.form.a.style.backgroundColor= (checked) ? '#FFE6E6':'#FFFFFF'">
    </form>

    Vinny

  3. #3

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    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
  •  



Click Here to Expand Forum to Full Width