如下圖所示:
//回傳數組類型function findPosition(oElement) {//oElement 當前元素
if (typeof (oElement.offsetParent) != 'undefined') {
0; oElement; oElement = oElement.offsetParent ) {
posX = oElement.offsetLeft;
}
}
return array;
}
//取得觸發事件的控制在整個頁面的絕對的X座標
function findPositionX(oElement 🎜> for ( var posX = 0; oElement; oElement = oElement.offsetParent)
{
posX = oElement.offsetLeft;
}
}
return posX;
}
//獲取觸發事件的控制項在整個頁面的絕對的Y座標
function findPositionY(oElement) {
if (typeof (oElement. for (var posY = 0; oElement ; oElement = oElement.offsetParent) {
posY = oElement.offsetTop; return posY;
}