Intermediate Web Publishing

Image rollover using JavaScript

<A HREF="index.html" 
 ONMOUSEOVER="home.src='homehl.gif'" 
 ONMOUSEOUT="home.src='home.gif'">
<IMG NAME="home" SRC="home.gif" BORDER=0></A> 

homeNote: no <SCRIPT> tag.
If it's not a button, use ONCLICK="return false"


Exercise: Copy home.gif and homehl.gif to your local hard disk. Create a rollover image using the above code.

[home.gif\
home.gif
[homehl.gif]
homehl.gif
Note: this very simple technique works only in Netscape 3/MSIE 4 and later.


[up] [next]JavaScript and forms