当我用 open 方法打开多个子页时,我关闭父页面想把子页面都关闭。这应该怎么解决啊。能不能给个详细的例子,谢谢好心人了。

解决方案 »

  1.   

    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript">
           var ows = new Array();
           function openwindow()
           {
              var o = window.open("test.html");
              ows.push(o);
           }
           window.onbeforeunload = function()
           {
              while(ows.length > 0)
              {
                 ows.pop().close();
              }
              
           }    </script>
    </head>
    <body>
        <form id="form1" runat="server">
          <input type="button" value="click" onclick="openwindow()" />
        </form>
    </body>