How to make images change to another image when the mouse is placed over them:
- Insert the following java script in your HTML page (best to put it right before your anchor tags):
Java script source
- You can use different names for the actual images left.gif, left2.gif, right.giff, and right2.gif. Just remenber to also use the correct file names in your anchor tag.
- Create your anchor tags as follows:
Click here to see the buttons in action!
- When the mouse is placed over the image the left.gif will change to left2.gif and right.gif will change to right2.gif. You can add more mouse over images on the page by adding more lines in step 1.
e.g.
{
a1=new Image;a1.src="left2.gif";
a2=new Image;a2.src="left.gif";
a3=new Image;a3.src="right.gif";
a4=new Image;a4.src="right2.gif";
a5=new Image;a5.src="up.gif";
a6=new Image;a6.src="up2.gif";
}
this above example would let you make three mouse over images on the page.
Made by Jeremy Parr-Pearson
Back to the "How Did We Do That?" page.