943,073 Members | Top Members by Rank

Ad:
Aug 8th, 2007
0

image gallery help

Expand Post »
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];
}
<inputtype="button"value="<<Previous"onClick='changeImage(-1);'/>
<input type="button" value="Next>>" onClick='changeImage(1);' />
Similar Threads
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: javascript function not working in firefox
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Problem with applying colors from form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC