title: Assign a specific bg color to an image in an array (Javascript Only)
body: <p>I'm using a script to generate a random header image, but I would like to be able to assign a specific background color behind each header when it loads. I'm wondering if it's possible to achieve this using only Javascript (unable to use any other language, unfortunately.) </p>
  
  <p>This is the random image script I'm using. For each of the 6 images, I'd like to assign a specific backgroundColor. I've tried a few things but nothing seems to be working. Any suggestions?:</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  
  function random_imglink(){
  var myimages=new Array()
  
  myimages[1]="image1.gif"
  myimages[2]="image2.gif"
  myimages[3]="image3.gif"
  myimages[4]="image4.gif"
  myimages[5]="image5.gif"
  myimages[6]="image6.gif"
  
  var ry=Math.floor(Math.random()*myimages.length)
  if (ry==0)
  ry=1
  document.write('&lt;img src="'+myimages[ry]+'" class="header"&gt;')
  }
  random_imglink()
  
  &lt;/script&gt;
  </code></pre>