the next thing is - since you want to change the name but indexing
might get screwy what you end up with is List | List inside "same
object one of which stays the same to ref imageIndex values and the
other moves around so that you can change the name without losing
pointers into the main do-Hicky { that's a computer science term }
then what you are stuck on is you are not calling onClick()
the "machine" is calling onClick()
then you just think about where you want the machine to go and write a
path for it then when you get that working you can throw whatever
the .js honchos want you to try throwing at it
On Nov 12, 6:26 pm, beth <eliz...@gmail.com> wrote:
> Thanks for that, that made sense but i didn't fix the problem.
> However, I did realize the core of the issue was that I shouldn't
> have been calling the onclick within the function that was creating
> the thumbnails.
> So which I solved the issue of why the imageIndex values were getting
> messed up, it left me with another problem:
> If I'm creating those thumbnail images on the fly, into an array, how
> do I know which thumbnail was clicked? I have built the function to
> change the main image, and it works well, but I have to explicitly
> tell it what to do for thumb0, thumb1, etc. I'm trying to write a
> function that knows which index was chosen. I'm probably overlooking
> something very simple, but I'm stuck!
> thanksbeth
>
> On Nov 10, 5:52 pm, Nathan Mynarcik <nat...@mynarcik.com> wrote:
>
>
>
>
>
>
>
> > try this:
>
> > 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-1){ //length gives you total; yet
> > arrays are zero based
> > imageIndex++;}
> > else {
> > imageIndex = 0;
> > };
> > };
>
> > }
>
> > Nathan Mynarcik
> > nat...@mynarcik.comwww.mynarcik.com
>
> > On Thu, Nov 10, 2011 at 11:32 AM, beth <eliz...@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.