/ 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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>