子窗口是iframe?既然是iframe,关A了就会全关的.

解决方案 »

  1.   

    A:<html>
    <head>
    <script language="JavaScript">
    var newWindow;
    function createNewWindow()
    {
    newWindow=window.open("B.html","_blank","height=300,width=300");
    }
    function closeNewWindow()
    {
    if(newWindow)
    {
    newWindow.newWindow.close();
    newWindow.close();
    newWindow=null;
    newWindow=null;
    }
    }
    </script>
    </head>
    <body onunload="closeNewWindow()">
    <form>
    <input type="button" value="点击创建新窗口" onclick="createNewWindow()"/>
    <input type="button" value="关闭新窗口" onClick="closeNewWindow()"></input>
    </form>
    </body>
    </html>
    B.html<html>
    <head>
    <script language="JavaScript">
    var newWindow;
    function createNewWindow()
    {
    newWindow=window.open("C.html","_blank","height=300,width=300");
    }
    function closeNewWindow()
    {
    if(newWindow)
    {
    newWindow.close();
    newWindow=null;
    }
    }
    </script>
    </head>
    <body onunload="closeNewWindow()">
    <h1>子页</h1>
    <form>
    <input type="button" value="点击创建新窗口" onclick="createNewWindow()"/>
    <input type="button" value="关闭新窗口" onClick="closeNewWindow()"></input>
    </form>
    </body>
    </html>
    C.html子子页
      

  2.   

    谢谢.
    如LS所写,解决了html.