?? 2.8 取得控件的絕對(duì)位置.htm
字號(hào):
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>標(biāo)題頁(yè)</title>
<script language="javascript">
function getAddress(e)
{
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent)
{
t+=e.offsetTop; //獲取X坐標(biāo)
l+=e.offsetLeft; //獲取Y坐標(biāo)
}
alert("x坐標(biāo)="+t+" y坐標(biāo)為="+l);
}
</script>
</head>
<body>
<input id="Button1" type="button" value="坐標(biāo)" onclick="getAddress(this)" />
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -