Entry
Can I access the cascaded style properties of a style class?
Jun 10th, 2000 15:11
Martin Honnen,
Only NN4 seems to provide that:
<HTML>
<HEAD>
<STYLE>
.className {
color: white;
}
.className {
background-color: orange;
}
</STYLE>
<SCRIPT>
function showStyleClass (className) {
var styleClass = document.classes[className].all;
var r = '';
for (var styleProperty in styleClass)
r += styleProperty + ': ' + styleClass[styleProperty] + '\n';
alert(r);
}
</SCRIPT>
</HEAD>
<BODY ONLOAD="showStyleClass('className');">
<DIV CLASS="className">
JavaScript.FAQTs.com
</DIV>
</BODY>
</HTML>
Note that IE5 has
elementReference.currentStyle
to provide the cascaded style of a document element.