Javascript 获取一个对象在页面中的位置坐标
<script language="javascript" type="text/javascript" > function getXY(Obj) { var h = Obj.offsetHeight; for (var sumTop=0,sumLeft=0;Obj!=document.body;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.offsetParent); sumTop = h+sumTop; return {left:sumLeft,top:sumTop} } </script>