function getPos(obj){ var pos={left:0,top:0} while(obj){ pos.left+=obj.offsetLeft; pos.top+=obj.offsetTop; obj=obj.offsetParent; } return pos; }
时间: 2024-11-05 06:46:22
function getPos(obj){ var pos={left:0,top:0} while(obj){ pos.left+=obj.offsetLeft; pos.top+=obj.offsetTop; obj=obj.offsetParent; } return pos; }