Click to See Complete Forum and Search --> : looking for an image script


yunome
12-02-2002, 10:37 AM
I am looking for a script I found severl months ago and now am ready to use it but cannot find it again. It is a script where when you mouse over a thumbnail image it displays a slightly larger image.
Thank you all for your help:)

AdamGundry
12-02-2002, 11:35 AM
Try this:

<img src="image1.gif" onmouseover="this.src = 'image2.gif'" onmouseout="this.src = 'image1.gif'">

This displays an image (image1.gif) which changes to image2.gif when the mouse moves over it, then resets when it moves out. (Using the onmouseover and onmouseout event handlers.)

You might want to preload the images if you have lots on one page, using something like this:

<script language="javascript" type="text/javascript">
var i1 = new Image();
i1.src = 'image2.gif';
</script>

Adam