PDA

View Full Version : CMotion Dynamic Image change



oliverlong
07-01-2005, 02:36 PM
This may be a little obvious and a javascript problem but on a navigation link click, i want to dynamically change the images in the CMotion bar when a new 'garden' selected. This is the script to change the id of the image:

for (i=1; i<mainArray[arrayNo-1].length; i++)
{
thumb = "thb"+(i);
ImageMain.src = "images/thb_" + mainArray[arrayNo-1][i];
document.getElementById(thumb).src = ImageMain.src;
}

in the html

<div id="motioncontainer" style="position:relative;width:200px;height:100px;overflow:hidden;">
<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">
<nobr><a href="javascript:imgPopUp('1')"><img id="thb1" src="images/thb_1.jpg" border=1></a>
<a href="javascript:imgPopUp('2')"><img id="thb2" src="images/thb_2.jpg" border=1></a>
<a href="javascript:imgPopUp('3')"><img id="thb3" src="images/thb_3.jpg" border=1></a>
<a href="javascript:imgPopUp('4')"><img id="thb4" src="images/thb_4.jpg" border=1></a>
<a href="javascript:imgPopUp('5')"><img id="thb5" src="images/thb_5.jpg" border=1></a></nobr>
</div>
</div>

Take a look at the site if you like:

http://www.oliverlong.plus.com/joyjardine/gall.htm

My apologies for the photos!

As you can see i am trying to impliment the image system with a navigation bar to allow for multiple sets of images. I'm declare this open source code so please feel free to take what i have done if you like it so far.

Thanks in advance!

jscheuer1
07-01-2005, 09:40 PM
The most obvious way to change the images shown in the cmotion gallery's train of images is to access and change the element with the id of 'motiongallery'. Ex:


document.getElementById('motiongallery').innerHTML='<nobr>new train of images goes here</nobr>'

oliverlong
07-06-2005, 08:16 AM
Thanks!

This worked great.