<HTML>
<HEAD>
<TITLE>The onmove event</TITLE>
<SCRIPT>
// Turn on 2-D positioning
document.execCommand("2D-position",false,true);function fnHandleMove() {
  oXDelta.innerText = event.srcElement.offsetLeft;
  oYDelta.innerText = event.srcElement.offsetTop; 
}
</SCRIPT>
</HEAD>
<BODY>
<form onmove="fnHandleMove();">
<B>Current Object:</B><BR>
X delta: <SPAN id=oXDelta>n/a</SPAN><BR>
Y delta: <SPAN id=oYDelta>n/a</SPAN><BR><DIV CONTENTEDITABLE="true">
<DIV style="width:300px;height:100px; background-color:red; position:absolute;">
Movable DIV</DIV>
</DIV>
</form>
</BODY>
</HTML>

解决方案 »

  1.   

    onmove事件,是窗口被移动的时候触发
    鼠标在窗口上晃是onmousemove事件
      

  2.   

    翻javascript权威结果:
        Netscape 4;Unix平台上的Netscape 4不支持它,在移动窗口时调用的事件处理程序……
    var x=window.screenLeft || window.screenX;
     var y=window.screenTop || window.screenY;
     alert (x+"\n"+y);
     function aaa(){
      if(((window.screenLeft || window.screenX)!=x) || ((window.screenTop || window.screenY)!=y)){
       alert("move");
       x=window.screenLeft || window.screenX;
       y=window.screenTop || window.screenY;
      }
     }
     window.setInterval("aaa()",300);