Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java script file count for slideshow, sorry I'm Lost!?!?!

Status
Not open for further replies.

Rlthomas

Programmer
Jul 1, 2008
4
GB
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>
 
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>
 
sorry little typo update this is the .js file that is actually made

var image1=new Image()
image1.src="slideshow/01_16.JPG"
var image2=new Image()
image2.src="slideshow/sero.jpg"
var image3=new Image()
image3.src="slideshow/expo013.jpg"
 
well i fixed it with no need for you lots java or lack of! tar very much you oxygen thieves! ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top