Hi –
How can I split the AUTO/STOP function into two separate functions: RUN and STOP in the script below:
I created a RUN button and a STOP button, and though the slideshow runs nicely with the existing script, it’s possible to START the slideshow from the STOP button, and visa versa.
How can I correct this?
All suggestions greatly appreciated.
Thanks –
Robsta
[color=Red]<SCRIPT LANGUAGE=”JavaScript”>
<!– Original: Mike Canonigo (
<!– Web Site: [url]http://www.munkeehead.com
<!– This script and many more are available free online at –>
<!– The JavaScript Source!! –>
<!– Begin
// Preload Images
NewImg = new Array (
“imgs/image1.jpg”,
“imgs/image2.jpg”,
“imgs/image3.jpg”,
“imgs/image1on.jpg”,
“imgs/image2on.jpg”,
“imgs/image3on.jpg”
);
var ImgNum = 0;
var ImgLength = NewImg.length – 1;
//Time delay between Slides in milliseconds
var delay = 2500;
var lock = false;
var run;
function chgImg(direction) {
if (document.images) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}
document.slideshow.src = NewImg[ImgNum];
}
}
function auto() {
if (lock == true) {
lock = false;
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
run = setInterval(“chgImg(1)”, delay);
}
}
// End –>
</script>