onmousemove="adjustCoords(event);"

        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">



function adjustCoords(event)

{

  var pos=document.getElementById("pos");



 
// Use the clientX and clientY properties to get the position of the

  // mouse relative to the window. The event object is passed as an

  // argument to this function.

  var lbl="On Window: " + "(" + event.clientX + "," + event.clientY + ")";



 
// Calculate the position of the mouse over an element. To do this, subtract

  // the position of the element the mouse is over from the mouse position. The

  // element's position can be determined from its boxObject.

  var offsetX = (event.clientX - event.target.boxObject.x);

  var offsetY = (event.clientY - event.target.boxObject.y);



 
// Assign the offsets to the text of a label.

  lbl+=" Relative to: " + event.target.tagName + "(" + offsetX + "," + offsetY + ")";

  pos.setAttribute("value",lbl);

}











 

 







 

 

 

 








arrow
arrow
    全站熱搜
    創作者介紹
    創作者 狼翔月影 的頭像
    狼翔月影

    狼翔天地

    狼翔月影 發表在 痞客邦 留言(0) 人氣()