Forum Moderators: open
Try a web search for "javascript rollover script download" or something similar to see what resources are available.
Failing that, our HTML Forum [webmasterworld.com] would be the best place to get javascript help around here. :)
1. Load the rollover images into the browser's cache
2. Name the spot where all graphics appear by using the "name=" attribute in the <img> tag
3. Detect onMouseOver and onMouseOut events in the anchor tag, NOT the <img> tag
4. Change the source file for the named image with each mouse position change
The BASICS, to rollover from image1.gif to image2.gif and back again, in the screen position I named "spot":
In the HEAD
over=new Image(ww,hh)
over.src="image2.gif"
In the BODY
<a href="url.html" onMouseOver="spot.src=over.src" onMouseOut="spot.src='image1.gif'"><img src="image1.gif" name="spot" width="ww" height="hh"></a>
On the thread I linked to above, our members add nice refinements to the basic idea. We've got some world-class javascript jockeys here.
<Hi. Thanks so much. I tried your code, and it didn't work - am I missing something?>
The reason it didn't work is the name is wrong in the image tag.
It should be the same as in the mouseover call - i.e. top.
The following code will work if you have images called RANDOM_OVER.GIF and RANDOM.GIF in thew same folder.
<a href="http://WWW.WHATEVER.COM/RANDOM.HTM" onmouseover="top.src='RANDOM_OVER.GIF" onmouseout="top.src='RANDOM.GIF">
<img name="top" src="RANDOM.GIF" width="50" height="50" border="0" alt="YOUR MESSAGE HERE"></a>