title: How to get `background-color` property value in Javascript?
body: <p><a href="http://jsfiddle.net/g098wLxL/" rel="nofollow">fiddle</a></p>
  
  <p>The following code alerts empty string:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="test"&gt;test&lt;/div&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>#test{
      background-color: #f00;
  }
  </code></pre>
  
  <p>SCRIPT:</p>
  
  <pre><code>alert(document.getElementById('test').style.backgroundColor)
  </code></pre>
  
  <p>But if I set bgcolor in javascript then it would alert the bgcolor value:</p>
  
  <pre><code>document.getElementById('test').style.backgroundColor='#ff0';
  alert(document.getElementById('test').style.backgroundColor) // rgb(255,255,0)
  </code></pre>
  
  <p>So, how can I get the bgcolor value without setting it in js that is defined in stylesheet?</p>
  
  <p>Note that I don't want to get a value at all if it comes from the user agent's stylesheet rather than mine.</p>