How can I stop a slide show

wxdqz

New Member
I have the script to start a slide show. The code below is a function that will start when a piece of text is clicked on the page. Now all I need is the ability to stop the script with a function that works when another piece of text is clicked. The text will most likely be stylized in CSS as a link, one being "start" and one being "stop". Here is the code that I have so far. Any suggestions on how I can stop it? Ultimately I would like it to show the picture that it stopped on, and when the start button is clicked, it will proceed with the next picture in the array.

var autoPx = new Array("image.jpg","image2.jpg", "image3.jpg")
var Pic = 0

function nextPic() {
if (document.images && Pic < 3) {
document.slide.src=autoPx[Pic]
Pic++
}
else if (document.images && Pic == 3) {
document.slide.src=autoPx[Pic]
Pic = 0
};

setTimeout("nextPic()",2500);
}

//-->
</script>



Thanks,
Brian
 
Back
Top