Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] image rollover


  • From: javascript@xxxxxxxxxx (javascript@xxxxxxxxxx)
  • Subject: [Javascript] image rollover
  • Date: Thu, 31 May 2001 14:49:22 -0000

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!