1. Operate style attributes
1.1 attributes of a style object
Document. getelementbyid ("BBB"). style. backgroundcolor = "red ";
// The Inline style is accessed or obtained by the attribute value of the style.
1.2 use the style object method // because IE does not support it, it is better to use the first method.
Getpropertyvalue (propertyname); // use the style in the CSS attribute: Background-color
Getpropertypriority ();
Item (INDEX );
Removeproperty (propertyname );
2. Operate the external style table. Because the style of all elements with this class will be changed once changed, we recommend that you use the style attribute of this element to change the style of an element.
2.1 obtain the CSS style table var ocssrules = document.stylesheet1_02.16.css rules | document. stylesheet [0]. Rules // rules set for IE
2.2 access a style ocssrules [0]. style. backgroundcolor
3. Check that the final style is read-only and cannot be changed. If you want to change the attribute of the style
3.1 Definition: The style displayed on the browser is overwritten due to the relationship of priority, and the display method is displayed on the browser.
3.2 ie document. getelementbyid ('dd'). currentstyle. backgroundcolor // the same as normal style
3.3dom document. defaultview. getcomputedstyle (odiv, null). backgroundcolor
Dom operation style sheet