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