473,616 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

search for and close all child windows thru parent window

zybernau
35 New Member
hi, all

in javascript
i need to close all the child windows[popup windows] that i have opened through a parent window

scenario:

* here i will be having as many as child window opened and name given to the child window can not be tracked because each will be having a different name, and
* i am using 70 to 80 popup windows [doing seperate operations] through out my page [parent window]
* there can be any number of child windows opened , at the time of user triGgers the event from the parent window to close all the child window that i have opened so far [currently opened child windows]

Thanks in advance

- rajamohan
Mar 22 '07 #1
6 10032
iam_clint
1,208 Recognized Expert Top Contributor
you need to open the windows in an array or something



popup[0] = window.open(yad da);
popup[1] = window.open(yad da);
popup[2] = window.open(yad da);
popup[3] = window.open(yad da);

then you can do something like

for (i=0; i<=popup.length ; i++) {
popup[i].close();
}
Mar 22 '07 #2
iam_clint
1,208 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1.  
  2. <script>
  3. var pop = new Array();
  4. function openwins() {
  5. pop[0] = window.open('http://www.google.com', 'test');
  6. pop[1] = window.open('http://www.google.com', 'test1');
  7. pop[2] = window.open('http://www.google.com', 'test2');
  8. pop[3] = window.open('http://www.google.com', 'test3');
  9. pop[4] = window.open('http://www.google.com', 'test4');
  10. }
  11. function closewins() {
  12. for (i=0; i<pop.length; i++) {
  13. pop[i].close();
  14. }
  15. }
  16. </script>
  17. <input type="button" onclick="openwins();" value="Open PopUps">
  18. <input type="button" onclick="closewins();" value="Close PopUps">
  19.  
example.
Mar 22 '07 #3
zybernau
35 New Member
hi all,

i am having a parent window,
for that many child windows are being opened.
i am having a reference for all the windows which are being opened in javascript as a array variable
[so i am free to close all the windows that are refrenced when needed]

, here for a functionality in my application , i am refershing the page for every 500 secs.

so here the windows opened before 500 secs losts there references in the javascript, so i have no handle to close those windows.
question no 1: is there any way close those orphan windows?

question no 2: is there any way to search for the internet explorer windows which are open and look for the specific parameter in that window and then closing the window[which are orphan]?

please help!!!

Thanks,
Raj.
Nov 16 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
I've merged this with an older thread.

Are you sure you need to refresh the whole page? Can you not refresh a part of the page instead to avoid losing references to the child windows?
Nov 17 '07 #5
zybernau
35 New Member
I've merged this with an older thread.

Are you sure you need to refresh the whole page? Can you not refresh a part of the page instead to avoid losing references to the child windows?
Thanks acoder for merging, and Yes i need to refresh the whole page, because i am extending the application and not creating a new, my change should not affect others flow

is there any other way of doing this[with out having a seperate frame/iframe]

Thanks once again,
Raj
Nov 19 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
Once you refresh the window, I think the references to the child windows will be lost. What exactly requires the page to refreshed every half second? Perhaps there is an alternative you haven't thought of.
Nov 19 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2893
by: jrefactors | last post by:
>From the main page, there are lots of links to open new window. i.e. <a href="#" onClick="window.open('child1.html')">Open Child Window</a> If I close the main page, I want to close all child windows also. That means I need to keep track all handles of the child windows whenever I open a new window. Correct? any suggestions on the approach? Please advise. thanks!!
1
4528
by: Joe D | last post by:
I think this is a simple question. But I am new to JS. Here is what I want to do: From a parent window, open a popup window (child) to get data from user, then user submit the request, close the child window, an ASP page is generated from server and displayed with data in parent window, rather than child window. Right now, I can display in child window. But do not know how to display in parent. TIA
10
2413
by: olga p. | last post by:
Hi, I would like to close the browser window when I open the new one. Now I'm getting really irritation message: do I really want to close it, yes or no. I just want to close the browser without the message. Does anybody know the solution? greatings,
1
1525
by: mike | last post by:
I have a parent page with a number of child rows on it. When I press an onclick event on the parent page a child window opens and deletes the child data from the db table, then the child window passes back that row to the parent window. The child window open up using: mydeltaskwin = window.open(mycgi,'task_delete','width=800,height=400,top=50,left=50,scrollbars=no');
2
9011
by: Guy Babbitt | last post by:
I have an MDI application that starts an instance of a child form at application start. I have an event handler on a combo box checking for the selected value to change. When the select value changes, I call a method on the parent form to change some menu options, and then I need to close the child form. My code looks something like this: private void ddlDatabase_SelectedIndexChanged(object sender, System.EventArgs e) {...
3
3742
by: Isabel | last post by:
How can you close all child browser windows that where open by a parent browser window? I have links on a parent (main) page that opens the child page as a separate browser. However, I need to be able to close all the opened child browser pages from the parent page. Thank you for your help, Isabel
2
2900
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open. Although the child form has a close button (with java script) if the user navigates the parent form to another form the child form is still open. Just wondering if there is a way to close the child form when the user navigates away with the parent...
0
1715
by: Tom | last post by:
Let's say I have an MDI parent that has 5 open child windows in it. Now let's say that I have a function in the MDI parent that attempts to close all the child windows. It's starts running, closing the child windows; however, let's say that the second window it attempts to close has a Closing event and in that event (for whatever reason) the e.Cancel gets set to true (maybe the user is in the middle of something and doesn't want that window...
1
4475
by: michal.podlewski | last post by:
Hi All, I have a problem with a simple (as I thought till now) thing: I want to make a link in a child-window which would change site in the parent-window and along with closing child window. The parent window name is "main". A made a link like this in the child-site: <a href="new_address.html" target="main" class="about" onclick="javascript:main.location='new_address.html';self.close();"> change and close </a>
0
8145
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
8592
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
8294
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,...
0
7118
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4060
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...
0
4140
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2576
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
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1439
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.