Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    textfield background color in javascript

    Hello,
    I have a register form on my site. The user fills it out then hits 'Register'.
    If the user name already exists then he is sent back to the register form and I want the username field background color to be gray as well as to be focused. I have this code:

    function blinkhere() {
    if (document.login.fname.value == "")
    {document.login.fname.focus();}
    else
    {document.login.user.focus();
    document.login.user.backgroundColor(#999999);}

    <BODY onLoad="blinkhere();">

    What is the correct line of code referring to background color above??

    Thanks your help
    magyar

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Try

    document.login.user.style.backgroundColor="#999999"
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •