I'm trying to create an automated slide show of images from a directory. The php side works fine that it reads all images in a directory and places them in an array. But how do I get javascript to list them one at a time on a page? I think it has something to do with the syntax below the second to last line of this code;
<img id="slideshow" src="824312204.jpg" />
Its just selecting this file. What do I have to do to make it read the files in the directory without me typing the files names in the code. The wildcards don't work as in
<img id="slideshow" src="*.*" />
Here's the rest of the javascript code;
<script src="getimages.php"></script>
<script type="text/javascript">
var curimg=0
function rotateimages(){
document.getElementById("slideshow").setAttribute("src", "upload/"+galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}
window.onload=function(){
setInterval("rotateimages()", 2500)
}
</script>
<div style="width: 170px; height: 160px">
<img id="slideshow" src="824312204.jpg" />
</div>
Any assistance will be appreciated.
<img id="slideshow" src="824312204.jpg" />
Its just selecting this file. What do I have to do to make it read the files in the directory without me typing the files names in the code. The wildcards don't work as in
<img id="slideshow" src="*.*" />
Here's the rest of the javascript code;
<script src="getimages.php"></script>
<script type="text/javascript">
var curimg=0
function rotateimages(){
document.getElementById("slideshow").setAttribute("src", "upload/"+galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}
window.onload=function(){
setInterval("rotateimages()", 2500)
}
</script>
<div style="width: 170px; height: 160px">
<img id="slideshow" src="824312204.jpg" />
</div>
Any assistance will be appreciated.