父窗口能否控制子窗口?

一个父窗口,能否做到当此父窗口被关闭时,调用onunload方法来关闭所有从此父窗口打开的子窗口
---------------------------------------------------------------

 1<body onunload="if(s1!=null) s1.close();">
 2<input onclick="aa()" type="button"/>
 3<script>   
 4var s1 = null;   
 5function aa(){   
 6s1 = window.open("3.htm");   
 7}   
 8</script>   
 9\---------------------------------------------------------------   
10  
11s1 = window.open("3.htm");返回句柄,可以对si进行操作   
12\---------------------------------------------------------------   
13  
14通过opener.close()或通过弹出窗口的句柄.close();   
15\---------------------------------------------------------------   
16  
17把打开的窗口记到一个数组里</body>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus