window.onbeforeunload = function() //author: meizz  
{  
    var n = window.event.screenX - window.screenLeft;  
    var b = n > document.documentElement.scrollWidth-20;  
    if(b && window.event.clientY < 0 || window.event.altKey){
    if(confirm("确定要保存吗?")) //
    {
      document.getElementById("divyinc").style.display="block";//提示了确定要保存吗?  但是为什么不执行 这句显示代码呢?   
      
        }  
      
     //这里可以放置你想做的操作代码  
   }
}     if(confirm("确定要保存吗?")) //点确定的时候   让div显示出来  为什么 我点确定却把网页关了呢 
   有不有我 网页关闭事件 当提醒了 确定保存的时候   让div显示出来  不把网页关了 

解决方案 »

  1.   

    windows.close()就是关闭当前页面啊
      

  2.   

     window.onbeforeunload = function() //author: meizz  
    {  
    return  e.returnValue='你真的要关闭吗?';
    }
      

  3.   

    因为你的代码没有阻止事件的进行
     如2楼所说
    如果不写return false  则事件继续进行    于是关闭了。
      

  4.   


     能不能在我贴的代码中改啊 ?  
    confirm("确定要保存吗?")这个方法 返回就是 true 和false