title: On click show random image(Javascript)
body: <p>I'm trying to create some sort of slide show based thing where when an image is clicked it replaces itself with a random image from a list of files. I've gotten the slideshow to work but it doesn't start with an image, instead I get a small square at the top, left corner of my screen.</p>
  
  <p>Here is my code so far.</p>
  
  <p>Function code:</p>
  
  <pre><code>&lt;script&gt;
  function pickimg2() {
      var imagenumber = 2;
      var randomnumber = Math.random();
      var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1;
      images = new Array;
      images[0] = "images2/pic1.png";
      images[1] = "images2/pic1.png";
      images[2] = "images2/pic2.png";
      var image = images[rand1];
      document.randimg.src = image;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Html code:</p>
  
  <pre><code>&lt;body onload="pickimg2"&gt;
  
  &lt;a href="" onClick="pickimg();return false;"&gt;&lt;IMG SRC="YOUR IMAGE1" name="randimg1" border=0&gt;&lt;/a&gt;
  
  &lt;/body&gt;
  </code></pre>