Re: Fw: Opening and closing windows
by "Cyanide _7" <leo7278(at)hotmail.com>
|
Date: |
Tue, 30 May 2000 17:15:14 CDT |
To: |
francis_mariani(at)hotmail.com |
Cc: |
hwg-languages(at)hwg.org |
|
todo: View
Thread,
Original
|
|
there are two ways of doing this. you can obtain a reference to any window
by its target or name. these can be set from the actual window object or
while creating a new window:
window.name = "foobar";
window.open("somefile.html","foobar","");
and the reference can be caught with the window.open method:
var myWin = window.open('',"foobar");
also, the window.open method returns the window object of the window just
created and can be caught by a varible:
var myWin = window.open("somefile.html","foobar");
in addition, each opened window has the opener property, which is a
reference to the window that just opened it. you can either capture a
reference to Window2 from Window3 and immediately call the close method from
the returned object:
// in Window3
window.open('',"Window2").close();
where Window2 was created with the name "Window2". or you can go through the
opener object:
// in Window3
window.opener.win2.close();
where Window2 was stored as a property *win2* of the openers window object:
// in Window1
window.win2 = window.open("somefile.html","Window2");
hope this helps. - Cyanide_7
>
>
> Hi!
>
>I would like to know how to reference a particular window in JavaScript.
>
>I have Window 1 that opens Window2 and Window3. From Window3 I would like
>to
>close Window2.
>
>Thanks,
>
>Francis.
>
>PS: I'm sorry if this seems like a simpleton question!
>
>
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA