SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Putting a mouseover event into a style?

    I want to have an image rollover event on my page occurring every time any link is touched with the mouse, but I don't want to put the same mouseover event inline with every link. I was thinking there might be a way of including it in a style command. Anyone know how to implement this?
    signature

  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You can use the A:hover pseudo-class and change the background image in the style. This would work in Internet Explorer 4+ and Netscape 6/Mozilla and most likely Opera.

    Another way that is more complex but would allow more complex results would be to assign the onmouseover event to a Javascript function. This function would then have to check whether the object is a link or not before it fires but once it does you could do anything that is possible in Javascript.
    Wayne Luke
    ------------


  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like the Javascript solution is the way to go. My image rollover is located elsewhere on the page (not part of each link). Where should I look for more info on coding the javascript?
    signature


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
  •