title: Change image in document.body
body: <p>I want to change the background of the html page with the following function:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  var imageID=0;
  function changeimage(every_seconds){
      //change the image
      if(!imageID){
          document.body.src="1.jpg";
          imageID++;
          alert(imageID++);
      }
      else{if(imageID==1){
          document.body.src="2.jpg";
          imageID++;
          alert(imageID++);
      }else{if(imageID==2){
          document.body.src="3.jpg";
          imageID=0;
          alert(imageID++);
      }}}
      //call same function again for x of seconds
      setTimeout("changeimage("+every_seconds+")",((every_seconds)*1000));
  
  }
  &lt;/script&gt;
  
  
  &lt;body onload="hidemenu(); testPage(); changeimage(2)"&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>But it wont. I know there is syntax error in document.body.src but can anyone tell me what is the correct way to change as the background image is coming through css.</p>