取得控件的绝对位置
//
javascript
< script language = " javascript " >
function getIE(e) {
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"/nleft="+l);
}
</ script >
< script language = " javascript " >
function getIE(e) {
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"/nleft="+l);
}
</ script >
/ VBScript
< script language = " VBScript " >< ! --
function getIE()
dim t,l,a,b
set a = document.all.img1
t = document.all.img1.offsetTop
l = document.all.img1.offsetLeft
while a.tagName <> " BODY "
set a = a.offsetParent
t = t + a.offsetTop
l = l + a.offsetLeft
wend
msgbox " top= " & t & chr ( 13 ) & " left= " & l, 64 , " 得到控件的位置 "
end function
--></ script >