现在有一个问题,就是页面上有一个层是根据页面表格的位置进行定位的,如果页面最大化,是没有问题的,但一旦页面缩小,那么这个层的位置就不对了,请高手指点下,取页面对象位置的的函数如下!!谢谢
function space(elem){
var e={};
e.left = e.top = 0;
now = elem;
while(now.tagName != "BODY" && now.offsetParent != null) {
e.left += now.offsetLeft;
e.top += now.offsetTop;
//alert(now.offsetParent);
now = now.offsetParent;
}
e.bottom = e.top + elem.offsetHeight;
e.right = e.left + elem.offsetWidth;
return e; 
}