当父窗口关闭时,关闭所有子窗口 [英] Close All child window when parent window close
本文介绍了当父窗口关闭时,关闭所有子窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在父窗口关闭时关闭所有子窗口
I want to close all child window when parent window close
推荐答案
<script type="text/javascript">
var windows = [];
function conf() {
var rand_no_c = Math.random();
var con = rand_no_c.toString();
var_win = 'child'+con.substring(2);
windows[var_win] = window.open('child.aspx',var_win,'width=1100,height=700,left=50,top=20,status=0');
}
function closewindow() {
for(w in windows) {
if(!windows[w].closed) {
windows[w].close();
}
}
}
</script>
<style type="text/css">
{margin: 0;padding: 0;}
</style>
</head>
<body>
<div>
<button type="button" onclick="conf();">open child window</button>
<button type="button" onclick="closewindow();">close all windows</button>
</div>
</body>
</html></script>
这会给你一个想法
This Will Give You An Idea
这篇关于当父窗口关闭时,关闭所有子窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文