Bobby

聚沙成塔 集腋成裘
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

停止有document.onstop,看微软的例子

<body   scroll=no>
<script>
document.onstop=fnTrapStop;
var   oInterval;
window.onload=fnInit;
function   fnInit(){
      oInterval=window.setInterval("fnCycle()",1);
}
function   fnCycle(){
      //   Do   something
}
function   fnTrapStop(){
      window.clearInterval(oInterval);
      alert();
}
</script>
</body>
___________________________________________________________________________________________

刷新与关闭

<body   scroll=no>
<script>
document.body.onbeforeunload=aa;
function   aa(){
if(event.clientY<0&&event.clientX>760||event.altKey)
alert("窗口关闭!")
else
alert("窗口刷新!")
}
</script>
</body>
//写死了宽度(clientX),超过760就不能使用
___________________________________________________________________________________________

移动窗口

<body>
<script>
var   leftpos,toppos;
window.onload=function(){
leftpos=window.screenLeft
toppos=window.screenTop
}
document.body.onmouseover=aa;
function   aa(){
if(window.screenLeft!=leftpos||window.screenTop!=toppos)
alert("窗口被移动了!")
leftpos=window.screenLeft;
toppos=window.screenTop;
setTimeout("aa()",1)
}
</script>
</body>
___________________________________________________________________________________________

<script language="javascript">
window.onbeforeunload = function()  //author: meizz
{
  var n = window.event.screenX - window.screenLeft;
  var b = n > document.documentElement.scrollWidth-20;
  if(b && window.event.clientY < 0 || window.event.altKey)
    {
        alert("是关闭");
  //  window.event.returnValue = "www";  //这里可以放置你想做的操作代码
    }
  else
    {
     alert("是刷新");
    }

}

______________________________________________________________________________________________

1   <input   type=button   value=刷新   onclick="history.go(0)">
2   <input   type=button   value=刷新   onclick="location.reload()">
3   <input   type=button   value=刷新   onclick="location=location">
4   <input   type=button   value=刷新   onclick="location.assign(location)">
5   <input   type=button   value=刷新   onclick="document.execCommand('Refresh')">
6   <input   type=button   value=刷新   onclick="window.navigate(location)">
7   <input   type=button   value=刷新   onclick="location.replace(location)">
8   <input   type=button   value=刷新   onclick="window.open('自身的文件','_self')">
9   <input   type=button   value=刷新   onClick=document.all.WebBrowser.ExecWB(22,1)>  
<OBJECT   classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2   height=0   id=WebBrowser   width=0></OBJECT>
10   <form   action="自身的文件">
<input   type=submit   value=刷新>
</form>
11   <a   id=a1   href="自身的文件"></a>
<input   type=button   value=刷新   onclick="a1.click()">