greeny_1984 14 Posting Whiz

hi everyone,
i doing an application on image gallery in which i have an thumbnails of pics and a big image .when ever i click on the thumbnail image it should be displayed in the big image and there are previous and next buttons aslo.iam using the following code,it is working fine when i never click on the thumbnails of images but when i click on the thumbnails in a ramdom way ,the prev and next buttons r not working in a corrext manner.Can any one say wats wrong in my code and how to improve it.waiting for u r reply
function funcdisplay(n)
{
if (document.images)
document.getElementById("myimage").src= "images"+"/" + "image" + n + ".jpg";
}
which_image_loaded = 0;
NUMBER_OF_IMAGES = 6;
ImageNames = new Object();
ImageNames.length = NUMBER_OF_IMAGES - 1;
var imagenumber
index=0;

for (counter = 0; counter < NUMBER_OF_IMAGES; counter++){
file_number = counter + 1;
filename = ("images"+"/" + "image" + file_number + ".jpg");
ImageNames[counter] = filename;
}
function changeImage(direction) {
which_image_loaded += direction;
if (which_image_loaded < 0)
which_image_loaded =NUMBER_OF_IMAGES - 1 ;
if (which_image_loaded == NUMBER_OF_IMAGES)
which_image_loaded = 0;
if (document.images)
document.myimage.src = ImageNames[which_image_loaded];
}
<input type="button" value="<<Previous" onClick='changeImage(-1);' />
<input type="button" value="Next>>" onClick='changeImage(1);' />

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.