title: Javascript: Interactive Slideshow
body: <p>So what I have done is a simple slideshow that loops three images.
  What I need to do know is add some js code to get my buttons working. Unless it's not clear by the name, I want to press the previous button to go back one image and the next button to go to the next image.</p>
  
  <p>Also I want to keep the code in seperate documents (one for html, one for css, one for js).</p>
  
  <pre><code>var image1 = new Image()
  image1.src = "pics/image1.png"
  var image2 = new Image()
  image2.src = "pics/image2.png"
  var image3 = new Image()
  image3.src = "pics/image3.png"
  
  var nr = 1;
  
  function slideshow() {
  
      document.images.slideshow.src = eval("image" + nr + ".src");
  
  if (nr &lt; 3) nr++;
  
      else nr = 1;
  
      setTimeout("slideshow()", 3000);
  
  }
  
  var prev = document.querySelector(".prev");
  var next = document.querySelector(".next");
  
  
  slideshow();
  </code></pre>
  
  <p>Find the full code here: here: <a href="http://jsfiddle.net/n5HHz/1/" rel="nofollow">http://jsfiddle.net/n5HHz/1/</a> (The image files are broken ofc)</p>
  
  <p>Very thankful for help!</p>