Javascript slideshow won't stop
<p>I'm creating a web page with a slide show activated by clicking a button. When I click the button the first time, I want the user to be prompted with how fast they want it to change to the next image before actually running the slide show. The next time the button is clicked, I want the slideshow to stop. Right now the first part is working, but when I click it a second time it just shows the prompt again and doesn't stop the slideshow. Can anyone tell me what I'm doing wrong? Here is my code for the given function:</p>

<pre><code>function slideShow(){
var temp2 = 0;
  if (temp2 == 0){
    var speed = prompt("How fast would you like to the slideshow to go?");
    var timerID = setInterval("clock()",speed);
    temp2 = 1;
  }
  else if (temp2 == 1){
  clearInterval(timerID);
  temp2 = 0;
  }
}
</code></pre>
