title: Random color table cell background
body: <p>I'm trying to give every "td" a different background-color.</p>
  
  <p>My javascript:</p>
  
  <pre><code>var color = '#';
  var letters= ['000000','FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF','C0C0C0'];
  color += letters[Math.floor(Math.random() * letters.length)];
  document.getElementById("bg").style.backgroundColor = color;
  </code></pre>
  
  <p>And my HTML:</p>
  
  <pre><code>&lt;td id="bg"&gt;...&lt;/td&gt;&lt;td id="bg"&gt;...&lt;/td&gt;
  </code></pre>
  
  <p>What happens is that every table cell have the same random color, but I need to have them with different color backgrounds.</p>
  
  <p>How can I do it? For loops?</p>
  
  <p>Can you please help me?</p>