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 3 3737
Isabel,
If it's just a single window close it via it's name.
window.[window name].close()
If you have multiple child windows open use an array:
<script language="JavaS cript">
<!--
openWins = new Array();
curWin = 0;
function openWin(page) { openWins[curWin++] = window.open(pag e,'_blank'); }
function closeAll() {
for(i=0; i<openWins.leng th; i++) if (openWins[i] && !openWins[i].closed)
openWins[i].close();
}
//-->
</script>
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Isabel" <ie****@hotmail .com> wrote in message
news:1f******** *************** ***@posting.goo gle.com... 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
Hi Isabel,
1. In the JavaScript window.open() method, assign the return value to a
variable that represents the child window.
2. Make sure that no PostBacks occur in the parent window prior to
attempting to close the child windows. Otherwise, the child window variables
will be lost (they are client-side, and specific to the instance of an HTML
document that launched them)
3. Use the child window variables created in the JavaScript window.open()
method to close the child windows.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
The more I learn, the less I know.
"Isabel" <ie****@hotmail .com> wrote in message
news:1f******** *************** ***@posting.goo gle.com... 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
Afraid not. Once the parent window is reposted, there is no connection
between parent and children. Each child window would have to close itself.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
The more I learn, the less I know.
"Isabel" <ie****@hotmail .com> wrote in message
news:1f******** *************** ***@posting.goo gle.com... Thanks Kevin. One followup question. I do need to perform a postback on my parent form. Is there anyway to not lose the references to the named child windows? Is there anyway to save them and have Javascript then be able to reference them to close the windows?
Thank you for your assistance.
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:<ec******* *******@tk2msft ngp13.phx.gbl>. .. Hi Isabel,
1. In the JavaScript window.open() method, assign the return value to a variable that represents the child window. 2. Make sure that no PostBacks occur in the parent window prior to attempting to close the child windows. Otherwise, the child window
variables will be lost (they are client-side, and specific to the instance of an
HTML document that launched them) 3. Use the child window variables created in the JavaScript
window.open() method to close the child windows.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer http://www.takempis.com The more I learn, the less I know.
"Isabel" <ie****@hotmail .com> wrote in message news:1f******** *************** ***@posting.goo gle.com... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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:
...
|
by: Prisy |
last post by:
I am working on a web application. When i log out of the parent window i
want all the child windows that are open to close. I picked one of the child
windows and tried the code shown below to close that child window but this
does not work. Does anybody have any suggestions?
<script language="javascript">
function openCalender()
{
win =...
|
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...
|
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...
| |
by: VhD50 |
last post by:
Hello all,
Is there a way that I can close all the mdi child windows from the mdi
parent's menu item? For example, on the MDI parent from, I have a MainMenu
with "File" and "Close All" menu items. I want that when a user clicks on
"File" then chooses "Close All", all the currently open MDI child windows
are close (the application should be...
|
by: zybernau |
last post by:
hi, all
in javascript
i need to close all the child 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 through out my page ...
|
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"...
|
by: =?Utf-8?B?RGF2ZVA=?= |
last post by:
I've got a situation in a VB 2003 Windows application with an MDI form and a
child form. In certain situations, when the child is closed by the user, I
also want to close the MDI parent. Is there a way to close the MDI parent
with code in the child form?
In the MDI child form, I have tried:
me.MDIParent.Close
but that doesn't appear...
|
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. ...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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
| |
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...
| |