日期:2014-05-17  浏览次数:20488 次

js onbeforeunload 中断事件
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 :关闭按钮,无论是确定还是,取消都直接关闭浏览器;求指点,

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