function getTop(obj) { var pos={left:0,top:0}; while(obj) { pos.left+=obj.offsetLeft; pos.top+=obj.offsetTop; obj=obj.offsetParent; } return pos; }
时间: 2024-12-22 09:57:09
function getTop(obj) { var pos={left:0,top:0}; while(obj) { pos.left+=obj.offsetLeft; pos.top+=obj.offsetTop; obj=obj.offsetParent; } return pos; }