function removeline(){        if(document.all.oframe.IsDirty)
       {
           if (confirm("文档已修改,确定关闭系统?")) {
                    window.opener = null;      
                            this.window.close();  
                       }   
               else
                  {
                       //这里需要返回生么样的值,才能取消关闭浏览器的事件
                       //return false; event.returnvalue=false;            都不行
                   }
       }
       else
       {
           window.opener = null;
           this.window.close();  
       }

</script>
<body style="margin: 0px;" onload="OpenDoc();" onbeforeunload ="javascript:removeline();" >
直接点击 浏览器的X :关闭按钮,无论是确定还是,取消都直接关闭浏览器;求指点,

解决方案 »

  1.   

    这个不能中断,你只能
    <body style="margin: 0px;" onload="OpenDoc();" onbeforeunload ="return 'xxxx';" >
      

  2.   

    那你就在修改内容的代码里面,动态注册 onbeforeunload 事件啊
      

  3.   

    多谢  net_lover 在旁指点;解决了;刚才提交失败,这里补上
    onbeforeunload 提示对话框 ,‘取消’ 可以终止 关闭浏览器事件;
    <HTML>
    <head>
    <script>
    function closeIt()
    {
      return "Any string value here forces a dialog box to \n" + 
             "appear before closing the window.";
    }
    window.onbeforeunload = closeIt;
    </script>
    </head>
    <body>
      <a href="http://www.microsoft.com">Click here to navigate to 
          www.microsoft.com</a>
    </body>
    </html>
    用onbeforeunload  取代confirm 来对用户进行提示;
    修改下代码就可以了;
            function removeline(){ 
                if(document.all.oframe.url!=undefined)
                {
                   if(document.all.oframe.IsDirty) {
                         return "文档已修改,确定离开??";
                   }
                   else
                   {
                         window.opener = null;
                         this.window.close();  
                   }
                }
               else
                 {
                    window.opener = null;
                    this.window.close();  
                  }
            }