Concerning the final style, there are differences between IE and Dom in their respective implementations.
1. The final style in IE, the Code is as follows:
<HTML> <br/> <pead> <br/> <title> accessing style sheets example </title> <br/> <style type = "text/CSS"> <br/> Div. special {<br/> background-color: red; <br/> Height: 10px; <br/> width: 10px; <br/> margin: 10px; <br/>}< br/> </style> <br/> <SCRIPT type = "text/JavaScript"> <br/> function getbackgroundcolor () {<br/> var odiv = document. getelementbyid ("div1"); <br/> alert (odiv. currentstyle. backgroundcolor ); <br/>}< br/> </SCRIPT> </P> <p> </pead> <br/> <body> <br/> <Div id =" div1 "class =" special "> </div> <br/> <input type =" button "value =" get background color "onclick =" getbackgroundcolor () "/> <br/> <p> the alert displays nothing because the background color of the <code> Div </code> is assigned by a class, not by the <code> style </code> attribute. </P> <br/> </body> <br/> </ptml>
2. Final style in DOM:
<HTML> <br/> <pead> <br/> <title> accessing style sheets example </title> <br/> <style type = "text/CSS"> <br/> Div. special {<br/> background-color: red; <br/> Height: 10px; <br/> width: 10px; <br/> margin: 10px; <br/>}< br/> </style> <br/> <SCRIPT type = "text/JavaScript"> <br/> function getbackgroundcolor () {<br/> var odiv = document. getelementbyid ("div1"); <br/> alert (document. defaultview. getcomputedstyle (odiv, null ). backgroundcolor ); <br/>}< br/> </SCRIPT> </P> <p> </pead> <br/> <body> <br/> <Div id =" div1 "class =" special "> </div> <br/> <input type =" button "value =" get background color "onclick =" getbackgroundcolor () "/> <br/> <p> the alert displays nothing because the background color of the <code> Div </code> is assigned by a class, not by the <code> style </code> attribute. </P> <br/> </body> <br/> </ptml>