title: Javascript slideshow error
body: <p>So I am trying to make a slideshow of the images I have where you press the start button to start the timer. I believe I have everything coded correctly, but it doesn't change the image ever. I'm not sure what could be wrong.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;Slide Show&lt;/title&gt;
      &lt;script type ="text/javascript"&gt;
          var i=0;
          var timeout;
          function preLoadImages()
          {
              if (document.images)
              {
                  fire = new Array();
                  fire[0] = new Image();
                  fire[0] = "./images/fire2.jpg";
                  fire[1] = new Image();
                  fire[1] = "./images/fire3.jpg"
                  fire[2] = new Image();
                  fire[2] = "./images/fire4.jpg"
                  fire[3] = new Image();
                  fire[3] = "./images/fire1.jpg"
              }
              else
              {
                  alert("There are no images to preload");
              }
          }
          function startSlideshow()
          {
              if (i &lt; fire.length)
              {
                  document.images["fire_pic"].src = fire[i];
                  i++;
              }
              else
              {
                  i = 0;
                  document.images["fire_pic"].src = fire[i];
              }
              timeout = setTimeout('startSlideShow()',1000);
          }
          function stopSlideShow()
          {
              clearTimeout(timeout);
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload = "preLoadImages()"&gt;
      &lt;img name="fire_pic" src="./images/fire1.jpg" height="289" width="432"/&gt;
      &lt;form&gt;
          &lt;br /&gt;&lt;br /&gt;
          &lt;input type=button value="Start Show" onClick="return startSlideShow();"/&gt;
          &lt;input type=button value="Stop Show" onClick="return stopSlideShow();"/&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>