•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 423,384 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,766 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1061 | Replies: 0
![]() |
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);' />
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);' />
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Generate Thumbnail images on the fly. (PHP)
- Free CMS (PHP)
- New Ajax Tutorial (IT Technologies and Trends)
- Dreamweaver Help (Site Layout and Usability)
- Forum Software (Existing Scripts)
- Hide all DIV's On Click (JavaScript / DHTML / AJAX)
- Flash - loaded swf image quality problems (Graphics and Multimedia)
- UploadHeaven.com...Free Image Host! (Post your Resume)
- Photo Gallery Control (ASP.NET)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: javascript function not working in firefox
- Next Thread: Problem with applying colors from form


Linear Mode