Posted By

pckujawa on 08/22/06


Tagged

javascript image mouseover


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
richardsky


javascript image mouseovers


 / Published in: JavaScript
 

Using CSS is, of course, the preferred method of performing mouseover image swapping, but it's good to have a few tricks up your sleeve. Here's one way of doing it with JS, but the images have to be pre-loaded, or else there'll be a slight lag in the image swap.

  1. <a href="location.htm"
  2. onMouseDown="document.images['img01'].src='images/b1c.gif'"
  3. onMouseOver="document.images['img01'].src='images/b1o.gif'"
  4. onMouseOut="document.images['img01'].src='images/b1.gif'">
  5. <img border="0" name="img01" src="images/b1.gif">
  6. </a>

Report this snippet  

You need to login to post a comment.