[Javascript] image rollover

nina at cvzoom.net nina at cvzoom.net
Thu May 31 09:49:22 CDT 2001


I'm using an image rollover for 4 navigation images that switch
back & forth from b&w to full color. The first one works fine,but 
when I add the other images, only the last one changes when I 
rollover any of the images.

Here's the script:

<SCRIPT LANGUAGE="JavaScript">
<!-- hide from none JavaScript Browsers
Image1= new Image(80,104)
Image1.src = "chairx.jpg"
Image2 = new Image(80,104)
Image2.src = "chairbw.jpg"

function SwapOut() {
document.imageflip.src = Image2.src; return true;
}

function SwapBack() {
document.imageflip.src = Image1.src; return true;
}

// - stop hiding -->
</SCRIPT> 
 

Here's the command:

<A HREF="bio.html" onMouseOver="SwapOut()" onMouseOut="SwapBack()"> 
<IMG NAME="imageflip" SRC="chairbw.jpg" WIDTH=80 HEIGHT=104 
BORDER=0></A>  

After adding the additional b&w and color images,I replace the 
word "imageflip" in document.imageflip.src  and in the command <IMG 
NAME="imageflip" to correspond with each new image. 

What am I doing wrong? Is there another way to do this? Thanks!
 











More information about the Javascript mailing list