PDA

View Full Version : Javascript duplicate code



Faldwin
15 Jul 2009, 01:48 PM
I modified the code from this (http://www.webmonkey.com/tutorial/Make_a_JavaScript_Slideshow) tutorial for making a javascript slideshow. I changed the play slideshow function to an onMousover event, and the pause function to an onMouseout event. I managed to get this to work, but then I tried to implement the same functionality on another picture on the same page. My goal is to create a series of pictures that animate(or more accurately, slip through several pictures) when you rollover them. In order to duplicate the code I went through the code and attached 01 to all the variables. Then I duplicated the code and changed the 01 to 02.

However, I can only get the first slideshow to run. According to Firebug the second element isn't even calling the Javascript function. I've checked, double checked, and triple checked for typos, so I know that isn't it.

You can view the page at testing.natureswheel.com (http://testing.natureswheel.com)
The javascript is in an external file, which can be viewed here (http://testing.natureswheel.com/animated_rollover.js)

The first picture acts like its supposed to, and the second one is supposed to act like the first, but doesn't for some reason. Even though all the pictures are the same now, on the final version of the site they will be different, so I can't just use the same pictures on every one.

Thanks in advance for any light you can shed on this issue.