Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2006, 05:27 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default getting all pop-ups

hi all,
   How shall I get the windows objects of all the pop-ups which have been opened through a certain page(via window.open call) just like the way one can get all of the window objects of child frames of a page through window.frames collection(and I don't want to save all the handlers of the pop-ups while opening them in order to close them later).


 
Old February 14th, 2006, 04:59 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can only do that by keeping track of them when they're opened, such as:
Code:
var popups = new Array();

function openWindow(sURL, sName, sFeatures) {
    var oPopup = window.open(sURL, sName, sFeatures);
    popups.push(oPopup);
    return oPopup;
}
Then use the openWindow() function whenever you want to open a new window. Each new instance will be saved in the popups array.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
 
Old February 26th, 2006, 08:25 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks but as I mentioned I don't tend to it this way.
if there were such a property in window object (for example childWindows[] )
then I could simply run a recursive function and close all open popups through any frame or popup when the user signs out in a complex portal...
 
Old March 7th, 2006, 01:22 AM
Authorized User
 
Join Date: Feb 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dimo414 Send a message via Yahoo to dimo414
Default

nzakas, but doesn't the variable oPopup only work inside the funtion openWindow?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Balloon pop-ups Cyber Shiva Javascript How-To 1 June 18th, 2008 01:08 PM
Explanatory pop-ups / second window ... asearle XSLT 6 January 8th, 2007 09:12 AM
Newbie Question RE Image pop ups Nostromo77 ASP.NET 2.0 Basics 0 December 10th, 2006 07:31 PM
open multiple pop-ups aspenthu ASP.NET 1.0 and 1.1 Professional 1 May 20th, 2006 04:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.