title: Change of image after a time interval
body: <p>I want to write a javascript function to change background image after every 24 hours for 30 days. </p>
  
  <p>For example, I have 4 images, image1.jpg, image2.jpg, image3.jpg and image4.jpg.</p>
  
  <p>I want image1.jpg to be displayed on Monday. Then by midnight I want to swap automatically to image2.jpg and so on.</p>
  
  <p>I was thing to use a java script function like this </p>
  
  <pre><code>function changeImg() {
  var now = new Date(),
      hours=now.getHours(),
      minutes=now.getMinutes(),
      seconds=now.getSeconds(),
      dayD=now.getDate(),
      dayM=now.getMonth()+1,
      datY=now.getFullYear(),
      timer = setTimeout("changeImg()",200);
  }
  
  var imgArray =  new imgArr[xyz.png,abc.png,........,30.png]
  </code></pre>
  
  <p>Now my question is that how to change automatically image after 24hours. If I use a for loop to increment the counter to change the image will it work. And is it correct way to do this and if i am using this way Is the timer will maintain the previous counter value. </p>
  
  <p>I want that every day at 9:00 am the background image will change.</p>