Return to Snippet

Revision: 921
at August 22, 2006 01:04 by pckujawa


Initial Code
<a href="location.htm"
onMouseDown="document.images['img01'].src='images/b1c.gif'" 
onMouseOver="document.images['img01'].src='images/b1o.gif'" 
onMouseOut="document.images['img01'].src='images/b1.gif'">
<img border="0" name="img01" src="images/b1.gif">
</a>

Initial URL


Initial Description
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.

Initial Title
javascript image mouseovers

Initial Tags
javascript, image

Initial Language
JavaScript