title: Javascript/Dom loading images in to grid
body: <p>I'm pretty new to programming and javascript/dom. Ultimately, I'm trying to make a sliding puzzle game but to start off with, I'm just trying to get the images loading up in a random order. It's going to be a 4x4 grid of images. The images are named Tree00, 01, 02, 03, 10, etc up to 33. Here's my code so far:</p>
  
  <pre><code>        &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Shuffle&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;script language="JavaScript"&gt;
  &lt;!--
  Pics = new Array();
  var Top = 16;
  
  for(i = 0; i &lt; Top; i++) {
    document.write("&lt;img&gt;&lt;img&gt;&lt;img&gt;&lt;img&gt;&lt;br&gt;");
  }
  
  function RandomInt(Min, Max) {
    RI = Math.floor(Math.random() * (Max - Min + 1)) + Min;
    return(RI);
  }
  
  function Shuffle() {
    N = RandomInt(0, 1);
    this.Image.src=Pics[N];
    this.Image.style.left = 220;
  
  
  }
  
  function ViewerObj(Image, Pics, i) {
    this.Image = Image;
    this.Image.style.left = 800;
    this.Pics = Pics;
    this.Shuffle = Shuffle;
    this.Image.id = "ID" + i;
  }
  
  function Randomise() {
    var i;
  
    for(i = 0; i &lt; Top; i++) {
      Viewers[i].Shuffle();
      Viewers[i].Image.style.left = 200;
    }
  }
  
  Viewers = new Array();
  var i;
  
  for(i = 0; i &lt; 3; i++) {
    Pics[i] = "images/Tree" + (i) + (i + 1) + ".jpg";  
  }
  
  for(i = 0; i &lt; Top; i++) {
    document.images[i].src = "images/Blank.jpg";
    document.images[i].style.left = 300;
    Viewers[i] = new ViewerObj(document.images[i], Pics, i);
  }
  
  
  //--&gt;
  &lt;/script&gt;
  &lt;h1&gt;Shuffle&lt;/h1&gt;
    &lt;form&gt;
      &lt;input type="button" value="Shuffle" onClick="Randomise();"/&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I just can't quite fathom what I need to be changing and how I'd go about it. Any help + explanation would be much appreciated. What I am trying to achieve is it loading every image but just in a random order, but with no duplicates.</p>