一.js方法
function getLTWH(obj)
{
var oLTWH={"left":0,"top":0,"width":0,"height":0};
if(document.all)
{
var oRect=obj.getBoundingClientRect();
oLTWH.left=oRect.left-2;
oLTWH.top=oRect.top-2;
}
else
{
oLTWH.left=obj.offsetLeft;
oLTWH.top=obj.offsetTop;
}
oLTWH.width=obj.offsetWidth;
oLTWH.height=obj.offsetHeight;
return oLTWH;
}
var obj = getLTWH(obj);传入对象
obj.left //得到此元素左边距