我想做的是,当我点击关闭IE窗口按钮时就弹出提示,然后要有“确定”和“取消”按钮,点击确定就关闭,否则取消就不关闭,要有提示信息,请问如何实现呢?谢谢大侠了。

解决方案 »

  1.   

    window.close();
    各个浏览器 对 open close 兼容不友好。
      

  2.   


    function close() { 
    if(confirm("是否关闭?")){
     window.opener=null;
     window.open('','_self');
     window.close();
      }else{
         return false;
        }

    <input type="button" onlick = "close()"/>
      

  3.   


    应该是window.close 的方法 不是单纯的写一个close(),不过你可以window.close = close();
      

  4.   

    好像有个什么unload事件来着  不知行不行
      

  5.   

    <html> 
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
       <title>onbeforeunload测试</title>
       <script>
       function checkLeave(){
             event.returnValue="确定离开当前页面吗?";
       }
       </script>
       </head>
       <body onbeforeunload="checkLeave()">
       </body>
       </html>