473,842 Members | 1,773 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 10113
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
2906
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
4537
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
2441
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
1535
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
9021
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
3758
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
2913
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
1725
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
4538
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
9865
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10303
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9446
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...
1
7853
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
7025
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5694
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
5882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4498
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
3
3140
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.