title: Dynamic colour changes on divs using javascript
body: <p>I need help. I can't get javascript to dynamically change colour of the three divs listed in code below. I have pasted the full code below...</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;style&gt;
  .box{
  width:100px;
  height:100px;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div class="box"&gt;
  quote 1
  &lt;/div&gt;
  &lt;div class="box"&gt;
  quote 2
  &lt;/div&gt;
  &lt;div class="box"&gt;
  quote 3
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  var bgcolorlist=new Array( "#ff33cc", "#cc33ff")
  
  $(".box").css("background-color",bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)]);
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>