The Mozilla equivalent of CurrentStyle

IE has a pretty nice DOM property called currentStyle that you can use to find out the resolved style properties of a DOM object. This is neccessary because the style property will only tell you what style properties have been set, they won’t tell you what properties have been inherited from the element’s parent nodes.

The equivalent in Mozilla and other standards compliant (civilized)browsers is a method of the document’s defaultView property called getComputedStyle():

  1. document.defaultView.getComputedStyle(document.getElementById("name"), null).width
Posted on 01 Sep 05 by Helen Emerson (last updated on 01 Sep 05).
Filed under Javascript