title: Javascript reads row backgroundColor as rbg but won't set backgroundColor
body: <p>I want to toggle the colour of a table row. Initially I want to remember what colour the row is.</p>
  
  <pre><code>var bg = table.rows[I].style.backgroundColor;
  </code></pre>
  
  <p>On one particular row bg might contain "rgb(240, 255, 248)"</p>
  
  <p>If I subsequently write:</p>
  
  <pre><code>table.rows[I].style.backgroundColor = bg;
  </code></pre>
  
  <p>the backgroundColor is not set.</p>
  
  <p>If I write:</p>
  
  <pre><code>table.rows[I].style.backgroundColor = '#F0FFF8';
  </code></pre>
  
  <p>the backgroundColor is set. </p>
  
  <p>Why does javascript read the backgroundColor as a rgb value but won't set the backgroundColor as that rgb value? How can I convert the rgb value javascript reads into a value it can write?</p>
  
  <p>Please note - I don't want to start setting css styles at this point. The current code is all generated from an already very complex .aspx page.</p>