点击IE关闭按钮时,想弹出个只有"是否要退出系统?"这几个字的提示框.我在网上找了些相关代码,但提示除了想要说的内容外,还会有一些,IE自带的提示话语,"确定要离开此页面  点'确定'继续,或按'取消'留在当前页面."由于需求问题这段话不能加.以下这段代码会出现如上问题!
<script language="javascript">  
  g_blnCheckUnload = true;  
  function RunOnBeforeUnload() {  
     if (g_blnCheckUnload)   
   {//注意异常的捕获  
     try{  
       window.event.returnValue = ’You will lose any unsaved content’;     
            }catch(e){}  
      }     }  
</script>  
<body  onbeforeunload="RunOnBeforeUnload()">  
</body>

解决方案 »

  1.   

    IE关闭时提示是否退出的解决方案
    http://topic.csdn.net/t/20040907/10/3347299.html
      

  2.   

    onunload 事件,别的貌似不好做
      

  3.   

    onunload 事件应该可以 我用过此事件得到关闭浏览器的时间,不乱报信息。
      

  4.   


    <html>
    <head> 
    <script language="javascript"> 
    function unloadCancel() 

     if(!confirm("确定要退出此页面吗?"))
       return;

    </script> 
    </head>
    <body onbeforeunload="unloadCancel();">   
    </body>
    </html>
      

  5.   

    function exit() {
         window.event.returnValue = “是否要退出系统?"; 
    }
    window.onbeforeunload=exit;