title: how to implement automatic sliding images through array in javascript
body: <p>I want to implement sliding images as soon as the website loads.</p>
  
  <p>Here's my html code</p>
  
  <pre><code>&lt;html&gt;
  &lt;title&gt;Wold of Guitars&lt;/title&gt;
  &lt;body onload="images()"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And here's my javascript</p>
  
  <pre><code>var imgArray = new Array();
  imgArray[0] = new Image();
  imgArray[0].src = '../img/n/h1.jpg';
  imgArray[1] = new Image();
  imgArray[1].src = '../img/n/h2.jpg';
  imgArray[2] = new Image();
  imgArray[2].src = '../img/n/home.jpg';
  imgArray[3] = new Image();
  imgArray[3].src = '../img/n/h3.jpg';
  imgArray[4] = new Image();
  imgArray[4].src = '../img/n/h4.jpg';
  x=-1;
  function images()
  {    x=x+1
       if(x&gt;4)
       x=1
       document.write("&lt;li&gt;&lt;img src='" + imgArray[x] + "' width="1350" height="630"/&gt;&lt;span&gt;" + imgArray[] + "&lt;/span&gt;&lt;/li&gt;");
       var t=setInterval("images()",3000);
  }
  </code></pre>
  
  <p>Help will be appreciated.</p>