In the process of debugging the Web page, often use JS to get the elements of the CSS style, there are many ways, now only I often use the method summarized as follows:
1. Obj.style: This method can only be JS can only get written in the HTML tag in the Style property of the value (style= "..."), and can not get defined in <style type= "Text/css" > inside the property.
2. The Obj.currentstyle method is used in IE, and FF is the getComputedStyle method
The DOM2-level style enhances the Document.defaultview and provides the getComputedStyle () method. This method takes two parameters: to get the element of the calculated style and a pseudo-element string (for example, ": after"). If no pseudo-element information is required, the second argument can be null. The Getcomputerstyle () method returns a Cssstyledeclaration object that contains all the computed styles of the current element. Take the following HTML page as an example:
To be Continued ...
JS using the getComputedStyle () method to get CSS property values