Otto Lang wrote on 12 okt 2006 in comp.lang.javascript
:
var bgColor = object.style.backgroundColor;
if ( bgColor != 'rgb(255, 255, 0)' ) {
<div style='background-color:yellow;'
onclick='alert(this.style.backgroundColor)'>
xxxxxxxxxxxx</div>
The above in IE6 and FF1.5 will alert: "yellow"
<div style='background-color:#f00;'
onclick='alert(this.style.backgroundColor)'>
xxxxxxxxxxxx</div>
will in IE 6alert #f00
in FF1.5 rgb(255, 0, 0)
<div style='background-color:rgb(255, 255, 0);'
onclick='alert(this.style.backgroundColor)'>
xxxxxxxxxxxx</div>
The above in IE6 will alert: "rgb(255,255,0)"
and in FF1.5 will alert: "rgb(255, 255, 0)"
[mind the spaces]
==========
So your test will not be cross browser, and probably not in browser
dependable.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)