//使用方法var tempobj = document.getElementById("控件ID");var pos = getAbsolutePosition(tempobj);alert(""+pos.x+","+pos.y);//函数function getAbsolutePosition(obj)...{position = new Object();position.x = 0;position.y = 0;var tempobj = obj;while(tempobj!=null && tempobj!=document.body)...{position.x += tempobj.offsetLeft + tempobj.clientLeft;position.y += tempobj.offsetTop + tempobj.clientTop;tempobj = tempobj.offsetParent}return position;}