在桌面上新建个文件a.htm
<input type=button value="关闭" onclick="if(confirm('是否关闭')){window.opener=null;window.close()}">
<body onunload="if(!confirm('是否关闭')){window.open('a.htm')}">

解决方案 »

  1.   

    楼上的写的太垃圾了,看看这个
    <script language=javascript>
    function window.onbeforeunload()
    {
    if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey){
      window.event.returnValue="确定要退出本页吗?";}
    }
    </script>
      

  2.   

    TO: Drowning(暑假好长啊~~)
    你的第二个方法怎么对象不支持此属性和方法的?有问题哦.
      

  3.   

    event.clientX>document.body.clientWidth && event.clientY<0||event.altKey
    是什么意思呢?能解释一下吗?
      

  4.   

    判断鼠标位置是否点击了关闭或是按alt+F4关闭的窗口