I. Getting the size of an element through a style inline
The style gets the width and height of the CSS style that can only be obtained into the inline style property, if there is a fetch, or null if none.
<script type= "Text/javascript" > function() { var// get element // 200px, empty if not set // 200px, empty if not set }</script>
Second, the size of the element obtained by calculation
The calculation gets the size of the element, regardless of whether you are inline, inline, or linked, and it is calculated to return the results.
If the size itself is set, it returns the size of the element, and if itself is not set, the default size is returned, and the ie6,7,8 browser returns auto.
<script type= "Text/javascript" > function() { varnull Null | | Box.currentstyle; alert (style.width); alert (style.height); } </script>
Third, get the element size by the Cssrules (or rules) property in the Cssstylesheet object
Cssrules (or rules) can only get the width and height of inline and link styles, and cannot get into inline and computed styles.
<script type= "Text/javascript" >window.onload=function(){ varsheet = document.stylesheets[0];//get link or style varRule = (Sheet.cssrules | | sheet.rules) [0];//get the first rulealert (rule.style.width);//200px, Emptyalert (rule.style.height);//200px, Empty } </script><style type= "Text/css" >. aaa{background: #ccc; width:200px; height:200px; }</style>JavaScript dom_ gets the CSS style setting element size