www.webdeveloper.com
Results 1 to 4 of 4

Thread: Text Field Hover Effect

  1. #1
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287

    Text Field Hover Effect

    Currently, I have a form, and it uses css for a hover effect, but I would like to change it, using JavaScript, I would like it to have the hover effect, and along side that, when the cursor is inside the text field/textbox blinking, I would like the background color to stay there until they go to another box.

    Any help?
    My settings

    Browser :: FireFox 1.5
    Resolution :: 1152x864
    Connection :: Cable Modem 2Mbs

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

  3. #3
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    You can use the :focus psuedo class on form fields to detect which one the user currently has selected, then you can apply a background colour using that, like so:
    Code:
    input:focus{
      background-color:#abc;
    }
    No JavaScript is needed at all for standards compliant browsers, however IE6 and lower doesn't support the :focus psuedo class on anything other than a link, so some JavaScript would have to be used, but only for IE.

    I would write some JavaScript for IE, but I know that the code already exists somewhere on the web, so I'll come back a post a link to it once I find it.
    Every fight is a food fight when you’re a cannibal.

  4. #4
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287
    Thank You, and I would like the javascript verison for IE as well, thanks.
    My settings

    Browser :: FireFox 1.5
    Resolution :: 1152x864
    Connection :: Cable Modem 2Mbs

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles