Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > closing a child window from parent

Reply
Thread Tools

closing a child window from parent

 
 
Tim
Guest
Posts: n/a
 
      10-19-2003
Hi all,

How can I close a child window from the parent window, even if I don't know
the child's name?
I hope there's something like a window.childs array that I can use..

Tia, Tim


 
Reply With Quote
 
 
 
 
Janwillem Borleffs
Guest
Posts: n/a
 
      10-19-2003

"Tim" <(E-Mail Removed)> schreef in bericht
news:bmu2d2$pvn$(E-Mail Removed)1.nb.home.nl...
> Hi all,
>
> How can I close a child window from the parent window, even if I don't

know
> the child's name?
> I hope there's something like a window.childs array that I can use..
>


There isn't, unless you create it yourself. For this you won't need to name
the popup, only to store a reference to the created child:


<script type="text/javascript">
childs = [];
function createWin(url) {
childs[childs.length] = window.open(url, '',
'width=500,height=500');
return childs.length;
}

function removeChilds() {
for (var i = 0; i < childs.length; i++) {
childs[i].close();
}
childs = [];
return childs.length;
}
</script>
.....
<form>
Current number of child windows:
<input type="text" name="child_count" value="0" /><br />
<input type="button" value="Create child"
onClick="form.child_count.value = createWin('')" />
<input type="button" value="Remove all children"
onClick="form.child_count.value = removeChilds()" />
</form>


JW



 
Reply With Quote
 
 
 
 
Tim
Guest
Posts: n/a
 
      10-20-2003
"Janwillem Borleffs" <(E-Mail Removed)> wrote >
> There isn't, unless you create it yourself. For this you won't need to

name
> the popup, only to store a reference to the created child:
>


So I can't close any pop-ups that I did not open by my own javascript..?
(I'd like to close the annoying pop-ups from my free webspace account).



 
Reply With Quote
 
Janwillem Borleffs
Guest
Posts: n/a
 
      10-20-2003

"Tim" <(E-Mail Removed)> schreef in bericht
news:bn0rka$nuu$(E-Mail Removed)1.nb.home.nl...
>
> So I can't close any pop-ups that I did not open by my own javascript..?
> (I'd like to close the annoying pop-ups from my free webspace account).
>
>
>


Not without a reference. BTW, those popups enable your free account. When
you don't like them why don't you search for a cheap payed service?


JW



 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      10-21-2003
Tim wrote:

> (I'd like to close the annoying pop-ups from my free webspace account).


You do know that this will most certainly violate your contract
with your service provider which could cost you your account?

You do know that people helping you to do this may become subject
to civil liability if not to criminal prosecution?


PointedEars, IANAL

 
Reply With Quote
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      10-21-2003
Thomas 'PointedEars' Lahn <(E-Mail Removed)> writes:

> Tim wrote:
>
> > (I'd like to close the annoying pop-ups from my free webspace account).

>
> You do know that this will most certainly violate your contract
> with your service provider which could cost you your account?


That is most likely correct.

> You do know that people helping you to do this may become subject
> to civil liability if not to criminal prosecution?


That is most likely *not* correct.
Definitly not criminal prosecution, unless they can somehow use the DMCA,
and I doubt that is possible.

/L, IANAL either.
--
Lasse Reichstein Nielsen - http://www.velocityreviews.com/forums/(E-Mail Removed)
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
 
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
closing parent window and child window JohnE ASP .Net 0 01-10-2010 07:08 AM
closing the child window and refreshing the parent window Ane007 The Lounge 1 05-05-2008 06:54 AM
Closing popup window when closing parent window? =?Utf-8?B?Vk1J?= ASP .Net 3 02-15-2007 08:29 AM
Closing child window and refreshing Parent window automatically =?Utf-8?B?U2lsZWVzaA==?= ASP .Net 4 10-14-2004 02:01 AM
Closing child window WITHOUT closing parent thomas Javascript 0 10-23-2003 04:10 PM



Advertisments