Click here to Skip to main content
16,019,140 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to close all child window when parent window close
Posted
Comments
ckulasekaran 7-Feb-12 7:35am    
Its means to close ur application?
use application.exit

1 solution

JavaScript
<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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900