Child windows not closing after refreshing parent page

18 views
Skip to first unread message

Mohd Anis

unread,
Nov 30, 2010, 12:39:20 AM11/30/10
to AppPad
I have this code for closing all child window with parent window but
after refereshing the parent window child window are not closing.
Bellow is code


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html lang="en">
<head>
<title>window manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<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('test2.html',var_win,'width=400,height=200,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>
<a href="javascript:" onclick="conf();">open child window</a>||
<a href="javascript:" onclick="conf();">open child window</a>||
<a href="javascript:" onclick="conf();">open child window</a>||
<a href="javascript:" onclick="conf();">open child window</a>||
<a href="test2.html">Click</a>
<button type="button" onclick="closewindow();">close all windows</
button>
</div>
</body>
</html>

AppPad

unread,
Dec 2, 2010, 3:43:51 PM12/2/10
to AppPad
Is this an apppad specific question?
It seems like this is more of a general javascipt issue..

On Nov 29, 9:39 pm, Mohd Anis <mohdanis2...@gmail.com> wrote:
> I have this code for closing all child window with parent window but
> after refereshing the parent window child window are not closing.
> Bellow is code
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/strict.dtd">
> <html lang="en">
> <head>
> <title>window manager</title>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>
> <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('test2.html',var_win,'width=400,height=200,left=50,top=20,statu­s=0');
Reply all
Reply to author
Forward
0 new messages