the problem  
code is as follows:


the document. The getElementById (" divFloat "). Style. The top=document. The getElementById (" Button "). The offsetLeft + 25;

unit found that need to be added value, then it is modified to the following:
code is as follows:


function getOffsetLeft (o)
{
var left=0;
var offsetParent=o;
the while (offsetParent!=null & & the offsetParent!=document. The body)
{
left +=offsetParent. The offsetLeft;
the offsetParent=offsetParent. OffsetParent;
} </p><P> Return the left;
}

代码如下:


$("#Button").offset().left

下载源码后发现jQuery是这样实现的
代码如下:


jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem=this[0],
//Get *real* offsetParent
offsetParent=this.offsetParent(),
//Get correct offsets
offset=this.offset(),
parentOffset=/^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
//Subtract element margins
//note: when an element has margin: auto the offsetLeft and marginLeft
//are the same in Safari causing offset.left to incorrectly be 0
offset.top -=parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
offset.left -=parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
//Add offsetParent borders
parentOffset.top +=parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
parentOffset.left +=parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
//Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent=this.offsetParent || document.body;
while ( offsetParent &&(!/^body|html$/i.test(offsetParent.nodeName) &&jQuery.css(offsetParent, "position")==="static") ) {
offsetParent=offsetParent.offsetParent;
}
return offsetParent;
});
}
});

calculation the same, but one thing is important to note:# 0 - #


This concludes the body part