如果我要关闭一个无状态栏 无工具栏的页面 这样会触发个什么样的事件?

解决方案 »

  1.   


    代码范例(1)
    <html>   
      <head>   
      <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
      <meta   name="GENERATOR"   content="Microsoft   FrontPage   4.0">   
      <meta   name="ProgId"   content="FrontPage.Editor.Document">   
      <title>浏览器关闭事件代码范例(1)-->刷新有问题</title>   
      </head>   
      <script   language="javascript">    
      function quit()   
      {   
              event.returnValue="do   you   want   to   exit   the   test?";   
      }     
      </script>   
      <body onbeforeunload="quit()">   
        hello   world!   
      </body>   
      </html>
    代码范例(2)
    <html>   
      <head>   
      <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
      <meta   name="GENERATOR"   content="Microsoft   FrontPage   4.0">   
      <meta   name="ProgId"   content="FrontPage.Editor.Document">   
      <title>浏览器关闭事件代码范例(2)-->刷新有问题</title>   
      </head>   
      <script   language="javascript">    
       function window.onunload()
    {
       alert("窗体关闭了!");
    }
      </script>   
      <body>   
        hello   world!   
      </body>   
      </html>
    代码范例(3)
    <html>   
      <head>   
      <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
      <meta   name="GENERATOR"   content="Microsoft   FrontPage   4.0">   
      <meta   name="ProgId"   content="FrontPage.Editor.Document">   
      <title>浏览器关闭事件代码范例(3)-</title>   
      </head>   
      <script   language="javascript">    
       function window.onbeforeunload()   
    {   
        if( event.clientX>document.body.clientWidth && event.clientY<0 || event.altKey )   
        {   
            window.event.returnValue="确定要退出本页吗?";   
        }
    }
      </script>   
      <body>   
        hello   world!   
      </body>   
      </html>
    以上部分转自http://yzying1980.blog.163.com/blog/static/59788992009320112945677/
      

  2.   

    查百度谷歌即可找到答案。 所用关键词:(js 刷新 父)、(js 关闭 浏览器
    刷新父页面:window.parent.location.href="父页面请求"; 
    关闭当前窗口:
    window.opener=null;window.close(); //ie6
    window.opener=('','_parent','');window.close();  //ie7
    //不弹提示窗
    function closeWindow() {   
        window.opener = null;   
        window.open('', '_self', '');   
        window.close();   
    }