title: Uncaught TypeError: Cannot set property 'src' of undefined
body: <p>url: <a href="http://www.gws-mbca.org" rel="nofollow">http://www.gws-mbca.org</a></p>
  
  <p>The slide show works in Firefox. It used to work in IE and Chrome. Now I get the following error in both IE and Chrome: </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot set property 'src' of undefined </p>
  </blockquote>
  
  <p>The script is linked using a <code>&lt;script type="...&gt;</code> in the document head. </p>
  
  <p>The code in the web page is as follows:</p>
  
  <pre><code>&lt;section style="margin: 0 auto; text-align: center;"&gt;
    &lt;img src="./rPix/rp1.jpg" id="slide" width="900" height="200" alt="slide show images" /&gt;
  &lt;/section&gt;
  
  
  &lt;body onload="runShow();"&gt;
  </code></pre>
  
  <p>The function <code>runShow</code> is part of slideshow.js - Code is as follows:</p>
  
  <pre><code>/* An automatically rotating slide show using Javascript and the DOM.
     This script cobbled together by Paul D.J. Vandenberg */
  
  var j = 1;
  var pix = new Array(11);
  
  for (i = 0; i &lt; pix.length; i++) {
    pix[i] = "rPix/rp"+j+".jpg";
    j++;
  }
  
  var index = Math.floor(Math.random() * 11) + 1;
  var limit = pix.length - 1;
  
  function runShow() { 
    if (index &gt; limit) {
      index = 0;
    }
    document.slide.src = pix[index];
    setTimeout("runShow()", 10000);
    index++;
  }
  </code></pre>