//el 节点对象
function getel(el){
var _t=0;
var _l=0;
if (document.documentElement.getBoundingClientRect){
var box = el.getBoundingClientRect();
var oDoc = el.ownerDocument;
//alert(navigator.appVersion);
if(navigator.userAgent.indexOf("MSIE 6.0") >= 0)
{
_t = box.top -2+ getScrollTop(oDoc);
_l = box.left -2+ getScrollLeft(oDoc);
}else
{
_t = box.top + getScrollTop(oDoc);
_l = box.left + getScrollLeft(oDoc);
}
}else{
while (el.offsetParent) {
_t += el.offsetTop;
_l += el.offsetLeft;
el = el.offsetParent;
}
}
return {top:_t,left:_l};
}
function getScrollTop(doc){
doc = doc || document;
return Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
}
function getScrollLeft(doc){
doc = doc || document;
return Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
}
兼容IE6/IE7/FF浏览器