Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > List of all Child Windows ?

Reply
Thread Tools

List of all Child Windows ?

 
 
Mel
Guest
Posts: n/a
 
      02-17-2005
is it possible to get a list of all child windows (poped from a parent
window) ?
and close all of them ?

thanks for help


 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      02-17-2005
In article <(E-Mail Removed)>, http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us
with...
> is it possible to get a list of all child windows (poped from a parent
> window) ?
> and close all of them ?
>


I believe this is only possible if you save handles to them as you open them.

--
--
~kaeli~
Contrary to popular opinion, the plural of 'anecdote' is
not 'fact'.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
 
 
 
RobB
Guest
Posts: n/a
 
      02-17-2005
Mel wrote:
> is it possible to get a list of all child windows (poped from a

parent
> window) ?
> and close all of them ?
>
> thanks for help


Something like this...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>untitled</title>
<style type="text/css">

input {
width: 80px;
font-size: 75%;
background: beige;
padding: 2px;
margin: 2px;
}

</style>
<script type="text/javascript">

function popit(n)
{
var w, wname = 'pop' + n;
var l = 100 * n + 100;
var t = 100 * n + 100;
w = window.open('javascript:"<h4>'+wname+'</h4>"',
wname,
'width=200,height=200,left='+l+',top='+t+',status= 0');
addName(wname);
return false;
}

function addName(wname)
{
self.name += (wname + '@');
}

function closeByName(wname)
{
window.open('javascript:"<script>window.close()<\/script>"', wname);
}

function closeAll()
{
var wname,
wcoll = self.name.split('@');
self.name = '';
for (var i = 0, l = wcoll.length; i < l; ++i)
if (wname = wcoll[i])
closeByName(wname);
return false;
}

</script>
</head>
<body>
<form>
<input id="w1" type="button"
value="open pop 1"
onclick="popit(1)" />
<br />
<input id="w2" type="button"
value="open pop 2"
onclick="popit(2)" />
<br />
<input id="w3" type="button"
value="open pop 3"
onclick="popit(3)" />
<br /><br />
<input id="ca" type="button"
value="close all"
onclick="closeAll()" />
</form>
</body>
</html>

Saves the popup name in - where else? - the name string of the opener
window. You can then get the (popup window) object back by calling
..open() again & using that name. The browser won't allow two windows
with the same name, so .open() simply loads a closer script in the
original. Storing it in the opener's name guarantees persistence across
pages (yours, anyway). No guarantees with this one...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pexpect on windows - child process of another child process - quickquestion Z W Python 0 03-09-2013 10:00 PM
Boa: howto make child windows really child bvidinli Python 0 04-15-2008 08:58 AM
How to list all Child Processes of an Applikation Jan Christoph Ruby 1 10-04-2007 10:28 AM
Child windows can not access window.opener when multiple child windows are open ian.michel@gmail.com Javascript 1 12-14-2004 10:07 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM



Advertisments