title: JavaScript - Can I make each image in an array a unique link
body: <p>I'm very new to JavaScript, and was hoping for some help.
  I'm trying to build a sliding banner, that has 5 different pictures displayed and rotated simultaneously. I've got that working with 5 versions of this code:</p>
  
  <pre><code>&lt;body onLoad="swapImage2();"/&gt;      &lt;!--Linked with jquery--&gt;
  
         &lt;script language="JavaScript"&gt; 
  var k = 0; var path2 = new Array(); 
  
  // LIST OF IMAGES 
  path2[0] = "pics/prime/1r.png"; 
  path2[1] = "pics/prime/2r.png"; 
  path2[2] = "pics/prime/3r.png"; 
  path2[3] = "pics/prime/4r.png";
  
  function swapImage2() 
  { 
  document.slider.src = path2[k]; 
  if(k &lt; path2.length - 1) k++; 
  else k = 0; 
  setTimeout("swapImage2()",6000); 
  } 
  &lt;/script&gt; 
  &lt;img class="small_banner" name="slider"/&gt; &lt;!-- This is where the image is displayed--&gt;
  </code></pre>
  
  <p>So the img tags is where the array item is displayed. I need each image in all 5 arrays to have it's own link to various pages in my site. 
  To clarify:</p>
  
  <pre><code>&lt;a href="#"&gt;&lt;img class="small_banner" name="slider"/&gt;&lt;/a&gt;
  </code></pre>
  
  <p>won't work, since that makes the entire display area one link, where I need pics/prime/1r.png (2r,3r,4r) to each be their own link.</p>
  
  <p>Here's the complete code as I'm using it:http:<a href="http://jsfiddle.net/BeaverKing/3wR5f/1/" rel="nofollow">http://jsfiddle.net/BeaverKing/3wR5f/1/</a></p>
  
  <p>I know I'm most likely missing something obvious, or perhaps I'm just using the wrong script for the job. If so, could someone suggest a better script?</p>
  
  <p>EDIT:</p>
  
  <p>I've spent the last week looking for a slider that does the job without success. I've tried using the bootstrap carousel, I've tried CarouFredSel, OwlCarousel, TimothySlider, WoW-Slider, CarouselEngine, CircularContentCarousel. None of these work stylistically with what I want, and when I tried to run multiple instances of the script, I was getting conflicts causing the code to break. I'm really not good enough to identify the conflicts in code, so I tried to write one myself. I'm posting my question here as a last resort. </p>