Some friends in JS cannot get the object value with xx. style. Top, which is very depressing. The reason is that only the style values can be embedded with the style values. That is to say, the value can be obtained only after this write:
<Div id = "XX" style = "width: 200px; Height: 200px; top: 100px;"> </div>
The following is a reference:
VaR divtop = divobj. style. Top // The embedded style attribute value is obtained only by embedding the style.
VaR divtop = divobj. currentstyle. Top // only Microsoft IE supports currentstyle, but Firefox does not.
// Getcomputedstyle () -- methods provided by Dom, supported by Firefox, Google, and ie9
VaR divtop = Document. defaultview. getcomputedstyle (divobj, null). Top;
It can also be obtained using: offsetleft.
For example:
XX. offsetleft; // XX indicates the object
For more information, see my other article: http://www.cnblogs.com/clouds008/archive/2012/05/17/2506861.html (skip)