Forum Moderators: open

Message Too Old, No Replies

         

bruhaha

8:38 pm on May 20, 2002 (gmt 0)

10+ Year Member



I'd like to set up some of my forms so that the background color of the field which currently has the focus would change. Any suggestions on the easiest way to do this?

txbakers

9:01 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you can use javascript/css for this:
onBlur='this.style.backgroundColor="white"' onFocus='this.style.backgroundColor="#ffffcc"'

bruhaha

2:16 pm on May 21, 2002 (gmt 0)

10+ Year Member



Thanks txbakers.
I've actually used "this.style" in other situations, and it certainly does the trick here.

But now I'm wondering... can I use more generalized javascript in the header (or a separate file) that will be called whenever a form-field is in focus (rather than placing that same snip of code in every single form field)?