In the section above this code (where the images are displayed), I would like to determine the number of each image. The variable 'count' only counts for the rows & cols, then resets for the next image grouping. How can I either (a) assign a number to each image in the array, or (b) pass the number 'currentImg' to the for i/for j loops above, such that clicking the direction updates this number automatically?
So what I want to do is pass the number of the item in the array (which I have numbered Item 1, Item 2, etc.) to function newWindow().
The trouble I am having is that in the array, the count never exceeds the number of rows time the number of columns. My array obviously has more than one page worth of images. Here is your code, just to refresh your memory. (I have added the table tags and the href.):
I try to use image_num to call the function, but after the first time the user flips forward or back, the count is irrelevant; it still just counts to six. I know that the number of the array is found in the document object somewhere, but I can't figure out how to reference it globally.
Joined: Nov 08, 2001
With a quick glance, we can remove the links and instead add an event handler to the image:
document.getElementById("Img" + i).onclick = new Function("newWindow(" + currentImg + ")";
You can add a css style to the images to get the pointer (cursor:p ointer;) so the user knows they can click on it.
I think that would solve your problem.
Eric [ December 19, 2005: Message edited by: Eric Pascarello ]
Joined: Dec 19, 2005
Many thanks. I am on the right track. I added the following line in the function changeimage: (It is the last line of the function.)