sfphoto
07-19-2010, 10:20 PM
Here is a simple slideshow with an on-off button. The images (7 defined) are numbered 01-07.jpg and in the same folder.
My question. How to call the images from a different folder with the script.
I can change the <img scr> HTML tag to include a directory where the images are but how do I tell the script?
Thanks in advance!
---page code below---
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<script type="text/javascript">
var Start = 1
var Timer3
function SlideShow()
{
if (document.all.ShowButton.value == "Stop Show") {
clearInterval(Timer3)
document.all.ShowButton.value = "Start Show"
} else {
document.all.ShowButton.value = "Stop Show"
Timer3 = setInterval("NextPic()" ,3000)
}
}
function NextPic()
{
Start += 1
if (Start > 7) {
Start = 1
}
document.all.Pic.src = "0" + Start + ".jpg"
}
</script>
<body>
<img id="Pic" src="01.jpg"></p>
<input id="ShowButton" type="button" value="Start Show" style="font-size:9pt"
onclick="SlideShow()"/><br>
</body>
</html>
My question. How to call the images from a different folder with the script.
I can change the <img scr> HTML tag to include a directory where the images are but how do I tell the script?
Thanks in advance!
---page code below---
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<script type="text/javascript">
var Start = 1
var Timer3
function SlideShow()
{
if (document.all.ShowButton.value == "Stop Show") {
clearInterval(Timer3)
document.all.ShowButton.value = "Start Show"
} else {
document.all.ShowButton.value = "Stop Show"
Timer3 = setInterval("NextPic()" ,3000)
}
}
function NextPic()
{
Start += 1
if (Start > 7) {
Start = 1
}
document.all.Pic.src = "0" + Start + ".jpg"
}
</script>
<body>
<img id="Pic" src="01.jpg"></p>
<input id="ShowButton" type="button" value="Start Show" style="font-size:9pt"
onclick="SlideShow()"/><br>
</body>
</html>