Changing Image


To see how this works just move your mouse over one of the images or link.





Goto My Links

This script can be placed anywhere within your page. Just copy the purple code, I will explain it at the bottom. This script doesn't work in Internet Explorer. Sorry!

<script language="JavaScript"><!--
// hide contents
browserName = navigator.appName;
browserVer  = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 3) version = "n3";
else version = "msie";
if (version == "n3")
 {

  menu1on = new Image; menu1on.src="IMAGE_ON.gif";
  menu1off = new Image(50,50); menu1off.src="IMAGE_OFF.gif";

  menu2on = new Image(50,50); menu2on.src="IMAGE_ON.gif";
  menu2off = new Image(50,50); menu2off.src="IMAGE_OFF.gif";

  menu3on = new Image(50,50); menu3on.src="IMAGE_ON.gif";
  menu3off = new Image(50,50); menu3off.src="IMAGE_OFF.gif";


 }

function img_act(imgName)

 {

  if (version == "n3")

   {
    imgOn = eval(imgName + "on.src");
    document [imgName].src = imgOn;
   } 

 }

function img_inact(imgName)

{        

 if (version == "n3") 

  {
   imgOff = eval(imgName + "off.src");
   document [imgName].src = imgOff;  

  } 

}
// --></script>


<a href="YOUR LINK HERE" A target="mainpage" onmouseover="img_act('menu1')" 
onmouseout="img_inact('menu1')"><img src="IMAGE_OFF.gif"  border="0" 
name="menu1">YOU MAY ADD TEXT HERE</a>

<a href="YOUR LINK HERE" A target="mainpage" onmouseover="img_act('menu2')" 
onmouseout="img_inact('menu2')"><img src="IMAGE_OFF.gif" border="0" name="menu2">
YOU MAY ADD TEXT HERE</a>

<a href="YOUR LINK HERE" A target="mainpage" onmouseover="img_act('menu3')" 
onmouseout="img_inact('menu3')"><img src="IMAGE_OFF.gif" border="0" name="menu3">
YOU MAY ADD TEXT HERE</a>

First thing that you need to do is change the names of the image files in this script (toward the top). For instance, the first ball picture, "IMAGE_ON.gif" is "ball_on.gif" and "IMAGE_OFF.gif" is "ball_off.gif". Next you need to put your link where it say "YOUR LINK HERE" and the "IMAGE_OFF.gif" file name (at the bottom of the script).

If you want to add more pictures, you'll need to insert the following lines. they are the same as the ones all ready in the code, just with different numbers and image files. For example, if you wanted a fourth image, the lines that you would insert would be....
(These goes after the lines of code that look just like it.)

  menu4on = new Image(50,50); menu4on.src="IMAGE_ON.gif";
  menu4off = new Image(50,50); menu4off.src="IMAGE_OFF.gif";
and

<a href="YOUR LINK HERE" A target="mainpage" onmouseover="img_act('menu4')" 
onmouseout="img_inact('menu4')"><img src="IMAGE_OFF.gif" border="0" name="menu4">
YOU MAY ADD TEXT HERE</a>
Notice how the menu number increased! If you want a fifth image, copy those lines and change it to menu5on, menu5off, and menu5.

If you want my images, here they are. ball_on.gif, ball_off.gif, red.gif, and red1.gif



Go Back to Doug's JavaScript Page