if (confirm ("关闭?"))
{
  window.open(...);
  self.close();
}

解决方案 »

  1.   

    <script>
    function window.onbeforeunload()
    {
    if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey)
    {  if(confirm('sure to quit?')!=1)
                  window.open('url');
               
               
              }
    }
    </script>
      

  2.   

    <script>
    function window.onbeforeunload()
    {
    if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey)
    {  if(confirm('sure to quit?')==1)
                  {window.open('url');}
             else
               {return false;}           
              }
    }
    </script>
      

  3.   

    bubuy(澎湃 NoMoneyToBuy) 的方法,
    不管确认取消都要重新打开窗口。
    除非正常关闭。
      

  4.   

    beforeunload事件在用户点击确定后,即会触发unload事件,当前窗口肯定要关闭,如果在用户点击确定后要打开一个新页面,可以在unload事件中新开一个窗口来打开新页面。
      

  5.   

    function dd2()
    {
       if (!confirm ("你是否真的要不退出就关闭浏览器!"))
      {
         window.open(url,"","");
      }
    }
      

  6.   

    <script language="javascript">
    function window.onbeforeunload()
    {
      if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
      {
        window.event.returnValue = "你是否真的要不退出就关闭浏览器!";
      }
    }
    </script>
    我的方法可以在用户点击取消的时候就不关闭窗口。但就不可以在用户点击确定时再作出处理。