Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
how to identify child window and close it using javascript
Meet Gaurav
Ranch Hand
Posts: 492
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi
I have a small web application and in that from main window I will open some child window and in case if the user closes the parent window. I like to close all child window. Please assist me how to do that...
Thanks
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Where's your code? What problems are you having with it?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Meet Gaurav
Ranch Hand
Posts: 492
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I need this functionality... I may open 4 to 6 child windows and I like to close all when the parent window closed
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Why wouldn't you just keep a reference to the child windows from the opening window?
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Still no code?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Eric Pascarello
author
Posts: 15385
6
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
http://radio.javaranch.com/pascarello/2005/01/19.html
Eric
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yeah, like that.
Meet Gaurav
Ranch Hand
Posts: 492
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks for all your reply.....
I got some working code. But still some problem.
<script language="JavaScript"> <!-- openWins = new Array(); curWin = 0; function openWin(page) { openWins[curWin++] = window.open(page, "_blank"); } function closeAll() { for(i=0; i<openWins.length; i++) { if (openWins[i] && !openWins[i].closed) { openWins[i].close(); } } window.close(); } //--> </script>
After opening 3 or 4 windows if the user refreshes the parent window all the values are lost and chils window are not closing..
Eric Pascarello
author
Posts: 15385
6
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Once the page refreshes you are toast. Your objects are destroyed and you have no more references.
Eric
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to close child window when parent closes
parent form reload?
parent-child window relationship
closing popup window after reference to jsp which's contentType is"application/excel?
How to close all child windows from parent window
More...