to: bencalie(Bencalie) 把你的经验说出来让大家分享?

解决方案 »

  1.   

    用win32 SDK + C 语言吧,什么都可以做到。
      

  2.   

    停止有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>
      

  3.   

    刷新与关闭<body scroll=no>
    <script>
    document.body.onbeforeunload=aa;
    function aa(){
    if(event.clientY<0&&event.clientX>760||event.altKey)
    alert("窗口关闭!")
    else
    alert("窗口刷新!")
    }
    </script>
    </body>
      

  4.   

    移动窗口<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>
      

  5.   

    To bencalie(Bencalie):
    你的刷新还是关闭里怎么写死其宽度(clientX)呀??
    <script language=javascript>
    function window.onbeforeunload()
    {
    if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey){
      window.event.returnValue="确定要退出本页吗?";
    }
    </script>
      

  6.   

    To meizz(梅花雨):因为你给这段如果body的scroll=no,就会无提示关闭了,你自己试试看?
      

  7.   

    前进、后退、刷新、关闭都响应事件 window.onbeforeunload但如何区分它们?
      

  8.   

    要认清这个问题,先要搞清楚script是什么东西,为什么能和浏览器和HTML文件对象模型打交道。javascript之所以能得到某些事件属性和调用方法,是因为浏览器对象为他提供了接口,用COM的术语来说,是IDispatch接口,如果浏览器对象没有为他提供接口,他什么也干不了。
    所以有些功能在其它语言中可以实现,而在javascript中是永远无法实现的。
      

  9.   

    你用VS6的OLE View察看一下 MSHTML Type library, dispinterface ,就知道究竟能不能实现了。
      

  10.   

    我现在就想在javascript中执行窗口上的刷新按钮,结果总是不刷新:
    但试我手工点击后就可以刷新,程序如下:
    1window.reload();
    2 openr.location.replace();
    3 window.refresh();
    4 window.location()
    这几种方式都试验过了,还是不行,有没有解决办法?
      

  11.   

    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()">
      

  12.   

    非常好。收藏,看来csdn还有真高手。