Forum Moderators: open

Message Too Old, No Replies

2 JavaScript Galleries on one page

two javascript galleries on one page problem

         

Peter_McC

9:15 am on May 23, 2007 (gmt 0)

10+ Year Member



Hi, I've added a JavaScript gallery to a page. When the visitor clicks on a thumbnail a larger picture is displayed and swapped as each thumbnail is clicked. The image title is also swapped for each picture. This works fine no problem there.

I need to add a second gallery on the same page, one gallery above the other and besides the content they work in the same way. I'm calling the same script but have changed the function names to productGallery1 and projectGallery2. I added a second function to the script for the second gallery, below;

---------------------------------------------------------------------
// Product Gallery2

function productGallery2 (imageFile, textFront, textColour, textMaterial)
{
document.getElementById('picture').src = imageFile;
document.getElementById('frontText').innerHTML=textFront;
document.getElementById('colourText').innerHTML=textColour;
document.getElementById('materialText').innerHTML=textMaterial;
return false;
}
---------------------------------------------------------------------

On the gallery page the first gallery works fine, but the second gallery is opening a new page and displaying the swapped image only.

I'm at a loss, any ideas?

Dabrowski

10:44 am on May 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The function on it's own looks ok. The problem is probably in the link, I'm assuming you have something like:
<a ...><img ...></a>

Can you post the HTML links for both galleries please.