title: javascript random image on page load and change over a period of time
body: <p>I'm trying to get this function to run when the page is loaded so that the images will change over a period of time. I can get this image to run onclick but it can't find a way for it run on load, i've tried everything I can find to try and do it</p>
  
  <pre><code>    var imgArray = []
              imgArray[0] = "url('../danallenfilms/images/screenshots/husky/shot1.png')";
              imgArray[1] = "url('../danallenfilms/images/screenshots/husky/shot2.png')";
              imgArray[2] = "url('../danallenfilms/images/screenshots/husky/shot3.png')";
              imgArray[3] = "url('../danallenfilms/images/screenshots/husky/shot4.png')";
              imgArray[4] = "url('../danallenfilms/images/screenshots/husky/shot5.png')";
  
      var numOfImg = imgArray.length
       function randomImg(){
  
  
           var randomNum = Math.floor(Math.random()*(numOfImg));
  
  
              document.getElementById('imgDisplay').style.backgroundImage = imgArray[randomNum];
  
      };
      setInterval(randomImg(), 1000);
  </code></pre>