title: Make an array in Javascript with images from a folder
body: <p>I want to navigate through images from a folder with JS, and i want to make an array of the files in the folder. I can't figure how to do that...I want to make the array |var <strong>images</strong>| and get rid of the links that i have manualy put them there.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Ranking Page&lt;/title&gt;
  &lt;script language="Javascript"&gt;
  
  var images = [
      "http://dummyimage.com/600x400/000/fff&amp;text=two",
  
      "http://dummyimage.com/600x400/000/fff&amp;text=one"
  
      ];
  var iIndex;
  var iLen = images.length;
  
  function fn_keydown(event) {
      var img = document.getElementById("wrapper").childNodes[1];
      if (event.keyCode === 39) {
          iIndex = (iIndex + 1) &gt;= iLen ? 0 : iIndex + 1;
      } else if (event.keyCode === 37) {
          iIndex = (iIndex - 1) &lt; 0 ? iLen-1 : iIndex - 1;
      }
      img.setAttribute("src", images[iIndex]);
  }
  window.onkeydown = fn_keydown;
  window.onload = function() {
      iIndex = iLen;
      var vEvent = {
              keyCode : 39
          };
      fn_keydown(vEvent);
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="wrapper"&gt;
      &lt;img /&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>