Hi I'm seeking a little java script help, I was hoping to get the total no. of images in a specific directory and put it in a variable named "j" so that I can cycle a slideshow properly, anyone got any ideas of how I might be able to do this, please?
I've already built a php image uploader which then creates a .js file listing the images and the id no's so that the slide show is easily updatable. Any help would be much appreciated
slides_java.js file created from php code
"
var image1=new Image()
image1.src="01_16.JPG"
var image2=new Image()
image2.src="sero.jpg"
var image3=new Image()
image3.src="expo013.jpg"
"
parts of page containing slideshow
"
<script language="JavaScript1.1" src="slides_java.js"></script>
<script>
<!--
//=====================
//
//=====================
var step=1
var whichimage=1
function slideit(){
j = 0; // I want to get the total no. of images / files in a specific folder in this case 'slideshow/' directory!
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<j) // if below last image keep cycling through
step++
else // otherwise start at the beginning again.
step=1
setTimeout("slideit()",2800) // almost three seconds inbetween each image
}
slideit()
function slidelink(){
window.location=eval("image"+whichimage+".src")
}
//-->
</script>
I've already built a php image uploader which then creates a .js file listing the images and the id no's so that the slide show is easily updatable. Any help would be much appreciated
slides_java.js file created from php code
"
var image1=new Image()
image1.src="01_16.JPG"
var image2=new Image()
image2.src="sero.jpg"
var image3=new Image()
image3.src="expo013.jpg"
"
parts of page containing slideshow
"
<script language="JavaScript1.1" src="slides_java.js"></script>
<script>
<!--
//=====================
//
//=====================
var step=1
var whichimage=1
function slideit(){
j = 0; // I want to get the total no. of images / files in a specific folder in this case 'slideshow/' directory!
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<j) // if below last image keep cycling through
step++
else // otherwise start at the beginning again.
step=1
setTimeout("slideit()",2800) // almost three seconds inbetween each image
}
slideit()
function slidelink(){
window.location=eval("image"+whichimage+".src")
}
//-->
</script>