Tutorial
- Create one image for the regular navigation. This will be called homeOn.
- Create one image for when you mouseover the first image. This will be called homeOff.
- Use this code in the body where you put the navigation.
<a href="LINKURLHERE" onMouseOver="changePic('home', 'homeOn')" onMouseOut="changePic('home', 'homeOff')"><img alt="Home" src="HOMEONURLHERE" name="home" border="0"></a>
- Replace LINKURLHERE with the page you want the button to lead to.
- Replace HOMEONURLHERE with the link to the image from step 1.
- Use this code in the head.
<script type="text/javascript">
homeOff = new Image;
homeOff.src = "HOMEONURLHERE";
homeOn = new Image;
homeOn.src = "HOMEOFFURLHERE";
function changePic(name, address) {
document[name].src = eval(address + ".src");
}
</script> - Replace HOMEONURLHERE with the link to the image from step 1.
- Replace HOMEOFFURLHERE with the link to the image from step 2.
Adding Another Button
Use the same code for each button, but make these changes each time:
Step 3 Code
- Change the three "home"s to the name of the second button.
- Change the one "homeOn" to the name of the second button with "On" at the end.
- Change the one "homeOff" to the name of the second button with "Off" at the end.
- Change LINKURLHERE and HOMEONURLHERE to your new URLs.
Step 6 Code
- Change the two "homeOn"s to the name of the second button with "On" at the end.
- Change the two "homeOff"s to the name of the second button with "Off" at the end.
- Change HOMEONURLHERE and HOMEOFFURLHERE to your new URLs.
- Remove the line that starts with "function".