473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

closing a child window from parent

Tim
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
Jul 20 '05 #1
5 9181

"Tim" <no****@nowhere.not> schreef in bericht
news:bm**********@news4.tilbu1.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

Jul 20 '05 #2
Tim
"Janwillem Borleffs" <jw@jwscripts.com> 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).

Jul 20 '05 #3

"Tim" <no****@nowhere.not> schreef in bericht
news:bn**********@news1.tilbu1.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

Jul 20 '05 #4
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

Jul 20 '05 #5
Thomas 'PointedEars' Lahn <Po*********@web.de> 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 - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Tom Szabo | last post by:
Is there an event when that triggers when the window is closing.... I am talking about when the user clicks on the cross on the right top corner of the window!!!
5
by: Ron L | last post by:
I have an MDI application with a number of child windows. In each child window I am catching the Closing event and having the child window decide if it should set cancel to true. The intent here...
1
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
4
by: Sileesh | last post by:
Hi I have a btn in Parent.aspx page . On server_click() of the Btn, i am opening a new window called the child.apsx window. Child window also have a Btn. On serverClick of this Btn, I perform...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: jd | last post by:
Hi guys, I'm trying to create an HTML page that contains two frames. The bottom frame should simply be some website, but the top frame needs to have a close link to kill the window. I tried calling...
2
by: javanet | last post by:
Hi all, 1) i opened a parent window. 2) then i opend a child window thruogh this parent window. Now i want to close child window before closing the parend window means my clients can not be...
19
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But...
4
by: reemamg | last post by:
From a parent window a new child window is open with window.open <script type="text/javascript" language="JavaScript" > function abc() { if(window.event.clientY <0 &&...
5
by: Nithu25 | last post by:
Hi All, I have a parent window where i have three links. On clicking those links, new window will be opened as a pop up. When i logout from the parent window, the child windows should be closed....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.