Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

on blur change text box colour???

Options
  • 09-07-2002 5:08pm
    #1
    Registered Users Posts: 706 ✭✭✭


    on blur change text box colour???

    Anyone know how to do it? That when a user selects clicks into a text box, the "class" changes to another value which has a different background colour set. I tried a view javascripts like change property in Dreamweaver MX but to no avail. Anyone know the actual script as I am not a javascript writer.

    Thanks

    Dave :)


Comments

  • Registered Users Posts: 706 ✭✭✭DJB


    I got a nice script that does what i need above for anyone that is interested.....

    <html>
    <head>
    <script language="javascript">
    <!--
    function changeColor(obj,color){
    obj.style.backgroundColor = color;
    }
    //-->
    </script>
    </head>
    <body>
    <form>
    <input type="text" style="background-color:red;" name="itembox" onFocus="changeColor(this, 'red')" onBlur="changeColor(this, 'blue')">
    <br>
    <input type="text">
    </form>

    </body>
    </html>

    Compliments of "aegiskleais" - www.udzone.com member.

    Regards,

    Dave


  • Moderators, Social & Fun Moderators Posts: 28,633 Mod ✭✭✭✭Shiminay


    I'd have changed the class - less maintainence over time. So you'd have something like
    function changeColor(obj){
      obj.className="theNewClass";
      }
    


  • Closed Accounts Posts: 2,695 ✭✭✭b20uvkft6m5xwg


    Thx for that UDZONE link DJB

    Looks promising :)


Advertisement