try this:
thumbnailArray[i] = document.createElement("img");
dynamicThumbs.appendChild(thumbnailArray[i]);
thumbnailArray[i].setAttribute("src",imageArray[i]);
thumbnailArray[i].setAttribute("width",100);
thumbnailArray[i].onclick = function(){
currentSlide.setAttribute("src", imageArray[i]);
currentSlide.setAttribute("href", linkArray[i]);
if (i < imageArray.length-1){ //length gives you total; yet arrays are zero based
imageIndex++;}
else {
imageIndex = 0;
};
};
}
Nathan Mynarcik
nathan@mynarcik.com
On Thu, Nov 10, 2011 at 11:32 AM, beth <elizaix@gmail.com> wrote:
for (i=0; i<imageArray.length; i++) {
thumbnailArray[i] = document.createElement("img");
dynamicThumbs.appendChild(thumbnailArray[i]);
thumbnailArray[i].setAttribute("src",imageArray[i]);
thumbnailArray[i].setAttribute("width",100);
thumbnailArray[i].onclick = function(){
currentSlide.setAttribute("src", imageArray[i]);
currentSlide.setAttribute("href", linkArray[i]);
if (i < imageArray.length){
imageIndex++;}
else {
imageIndex = 0;
};
};
}
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To post to this group, send email to javascript-information@googlegroups.com.
To unsubscribe from this group, send email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascript-information?hl=en.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.