cdparmeter
New member
I'm building a page that has a simple easy javascript slide show. the hard thing is I want to include several slide shows different folders of images on the same page. the folders all have different numbers of images in them. what I'm looking for is a catch for the javascript to realize there isn't a file that exists by that name and start the loop over...... I don't know if I can do it with javascript or if I have to move up to ajax....
<script type="text/javascript">
var filename;
var image=1;
var t;
function switchimage(){
image=image+1
document.getElementById('image').src=filename
+ "/" + image + ".jpg";
t=setTimeout(switchimage, 2500);
if(image=?????? if the image doesn't exist){
image=1}
}
the the file name will change by changing the filename var.
hopefully that makes enough sense that someone will understand thanks for the help.
<script type="text/javascript">
var filename;
var image=1;
var t;
function switchimage(){
image=image+1
document.getElementById('image').src=filename
+ "/" + image + ".jpg";
t=setTimeout(switchimage, 2500);
if(image=?????? if the image doesn't exist){
image=1}
}
the the file name will change by changing the filename var.
hopefully that makes enough sense that someone will understand thanks for the help.