語法:
oElement = document . elementFromPoint ( iX , iY )
參數:
iX :  必選項。整數(Integer)。單位:象素(Pixel)。定位橫坐標偏移量。
iY :  必選項。整數(Integer)。單位:象素(Pixel)。定位縱坐標偏移量。

返回值:
oElement :  對象(Element)。返回獲取的對象的引用。

說明:
根據橫縱坐標值 iX 和 iY 獲取物件 oElement 。 oElement 必須支援和回應滑鼠事件。
提供的座標是客戶區座標。客戶區的左上角為 (0,0)。
當將此方法用於 Structured Graphics 或 Sprite 物件時,必須設置 MouseEventsEnabled 屬性值為 1 。
示例:(www.aspxuexi.com)
<script>
function rdl_eventHandle(e){
event.cancelBubble=true;
var oPoint=document.elementFromPoint(event.clientX,event.clientY);
if (oPoint.tagName.toLowerCase()!="li") oCode.innerHTML="請將滑鼠移動到專案列表上。";
else oCode.innerHTML="您的滑鼠指標現在位於<font color='#FF3300'>"+oPoint.innerText+"</font>上面";
}
document.onmouseover=rdl_eventHandle;
</script>


<ul id=oList style="cursor:default;">
<li>列表項目1
<li>列表項目2
<li>列表項目3
<li>列表項目4
</ul>
<br><div id=oCode>請將滑鼠移動到專案列表上。</div>

 


arrow
arrow
    全站熱搜

    Roger 發表在 痞客邦 留言(0) 人氣()