473,796 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9196

"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,heig ht=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_cou nt" value="0" /><br />
<input type="button" value="Create child"
onClick="form.c hild_count.valu e = createWin('')" />
<input type="button" value="Remove all children"
onClick="form.c hild_count.valu e = removeChilds()" />
</form>
JW

Jul 20 '05 #2
Tim
"Janwillem Borleffs" <jw@jwscripts.c om> 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*********@we b.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
9817
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
2261
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 is to ensure that no child window can close while it is in a state where user entered information can be lost. I have just noticed that while the Closing event is caught if I click the X on the child window, it is not caught if I click the X on...
1
5824
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 MDI child window. My application does certain logic when the user actually closes the MDI child form by clicking the "X" in the upper right hand. My application, however, should not execute this logic if the user closes the MDI parent. I...
4
4259
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 some operation . Once the operation is done, i have to close the child window, and refresh the parent window automatically. I am able to close the child window automatically , But not able to refresh the parent window.
10
4030
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
1
7639
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 'document.window.close()' from the child frame, but without success. I then tried putting the 'close()' call in the parent page and calling it from the child, but still without success. Can anyone take a look at the HTML/Javascript below and...
2
2180
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 close the parent window without closing the child window. please reply me. if there is any solution for this....
19
3228
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 these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
4
3182
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 && window.event.clientY <-80 ) { if (win2 && !win2.closed) // win 2 is the child window
5
3083
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. I can close the child windows when i close the parent window using the following code The following function i am calling "onUnload" event in the body tag of parent window.
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.