<script>
function onUrlchange () {
      if(GetAppParam('state')!=0) {
         window.event.returnValue= "要离开吗."
         window.event.cancelBubble=true;
      }
   }</script>
<BODY  onbeforeunload="onUrlchange();" bgColor="#c0c0c0" leftMargin="0" topMargin="0" scroll="no" marginwidth="0" marginheight="0">
</body>

解决方案 »

  1.   

    <script>
    function onUrlchange () {
          
             window.event.returnValue= "要离开吗."
             window.event.cancelBubble=true;
         
       }</script>
    <BODY  onbeforeunload="onUrlchange();" bgColor="#c0c0c0" leftMargin="0" topMargin="0" scroll="no" marginwidth="0" marginheight="0">
    </body>
      

  2.   

    <script language=javascript>
    function window.onbeforeunload()
    {
      if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
      {
        window.event.returnValue = "";
      }
    }
    </script>
      

  3.   

    To: mandolin(伤心曼陀铃) 试试刷新?? 你没有判断是否为刷新.
      

  4.   

    to:meizz(梅花雪)我把代码加在有FRAMESET那个页面里了,也就是分框架那个页面,可那个页面中没有body啊,取不到document.body
      

  5.   

    我上面不是说了吗: 你可以找一个占全宽的子框架, 取其宽度再与鼠标点击坐标比较而判断
    function window.onbeforeunload()  //author: meizz
    {
      var b = window.event.clientX>window.frame1Name.document.body.clientWidth-20;
      if(b && window.event.clientY < 0 || window.event.altKey)
      {
        window.event.returnValue = "";
      }
    }
      

  6.   

    To:meizz(梅花雪) 
    有搞头哦。
    学了