<script language=javascript>
function window.onbeforeunload()
{
  if(event.clientX>document.body.clientWidth && event.clientY<0||event.altKey)
  {
     window.event.returnValue="确定要退出本页吗?";
  }
}
</script>

解决方案 »

  1.   

    关不掉的窗口
    <script>
    if(opener) {
      opener.opener = "";
      opener.close();
    }else
      open(location.href);
    </script>
    <script for=window event=onunload>
    if(!opener) {
      opener.opener = "";
      opener.close();
    }
    open(location.href);
    </script>
      

  2.   

    这样试试
    <body onbeforeunload="Exit()">
    <script>
    function Exit() {
     if(event.clientX > document.body.clientWidth && event.clientY < 0||event.altkey)
      if(!confirm("真要关闭窗口吗?"))
       open(location.href);
    }
    </script>
      

  3.   

    <script language=javascript>
    <!--
    function stoprefresh()

        return "确定要退出本页吗?";
    }
    window.onbeforeunload = stoprefresh;
    -->
    </script>
      

  4.   

    to 天马行空兄弟
    你的回答比较好,但是好象对于showModelessDialog和showModalDialog弹出的对话框就没有作用了,
      

  5.   

    谢谢大家!我想是通过showModelessDialog和showModalDialog方式弹出的对话框,当我关闭右上角的叉叉时给我提示是否真的要关闭窗口
      

  6.   

    function window.onbeforeunload()
    {
    if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey)
    {ende();}
    }
    function ende(){
         if(!confirm("真要关闭窗口吗?"))
       open(location.href);
    }