SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Dec 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Input onFocus with a global script

    I really like the effect of using onBlur and onFocus for text-fields, and onMouseover and onMouseout, like so:
    Code:
     <label for="email">Email Address:</label><input class="form-text" id="email" name="email" onfocus="this.style.backgroundColor='#ccc';" onblur="this.style.backgroundColor='#E8E8E8';" /><br />
     <p class="center"><input class="button" type="submit" value="Submit Information" onmouseover="this.style.backgroundColor='#ccc';" onmouseout="this.style.backgroundColor='#E8E8E8';" /></p>
    See it live on (http://swve.deanforamerica.com)

    In fact, I like it so much that I want that effect for every input on my site. Problem is the CMS can't be edited to include this in every input tag. Is there a JS I can include that will take every input and add the onFocus/onBlur if it is class "form-text", and onmousever/onmouseout for class "button">

    If that isn't possible, what about just the onFocus/onBlur for all inputs?

    I don't really know JS, but it seems to me that this should be possible. 30 minutes of SitePoint and Google searching hasn't turned up anything, so perhaps it's not.

    Any help would be appreciated.

    Cameron
    Last edited by CameronCorda; Jan 5, 2004 at 05:07.


Bookmarks

Posting Permissions

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