<body onbeforeunload="window.open('clear.asp')">

解决方案 »

  1.   

    <html>
    <head>
    <title></title>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    <SCRIPT language=JavaScript>
    <!--
    var currentKeyCode = -1;function document.onkeydown() {       top.currentKeyCode = event.keyCode;
    }function window.onunload() {      var sw = 0, s0 = "";
          if (currentKeyCode == 116) {s0 += "刷新窗口!(F5)";}
          else {if ((event.altKey)&&(currentKeyCode == 115)) {s0 += "关闭窗口!(alt+F4)"; sw = 1;}
                else {if ((event.clientX > 0)&&(event.clientX < document.body.clientWidth)) {s0 += "刷新窗口!";}
                      else {s0 += "关闭窗口!"; sw = 1;}
                }
          }
          if (sw == 1) {endProcess(s0);}
          else {currentKeyCode = -1;}
    }function endProcess(s) {      alert(s);
    }//-->
    </SCRIPT>
    </head>
    <body>
    有关刷新和关闭
    </body>
    </html>
      

  2.   

    endProcess(s)中的alert(s)换成:
    window.open('clear.asp')
      

  3.   

    onunload="清除程序"
    應該可以吧?
      

  4.   

    onunload="清除程序"   不行,刷新时也触发unload事件