View Full Version : How to get a window reference?
02-24-2003, 04:19 PM
I have a window with links, some of these links open another window. If that window is already open, it opens that link in the same window.
The problem is, I don't want to reload this new window every time, I just would like to call a function inside it, if it is already open. To do so I need a reference to it. How can I get the reference to this window?
The opener window can be reloaded, so I can't just store it in a variable.
Hope it makes some sence...
02-24-2003, 08:42 PM
Then you can reference the window using the variable NewWin. So to reference a function in that window you could try NewWin.function_name().
02-25-2003, 02:48 PM
Thanks for answering, but I meant it slightly different...
The problem is when the opener window has been reloaded, and I'd like to call a function in the new window.
Image this scenario:
1. Load main window.
2. Click on link that opens a new window (child window).
3. Click on the same link in the main window. This time the child window is already loaded, so I just want to call a function.
4. Click on a link in the main window, that reloads itself.
5. Click on that first link in the main window again. The child window is still loaded, so I only want to call a function again.
How can I get the reference to the child window this time?
02-25-2003, 03:25 PM
Basically you want to get access to all the desktop windows - whether the main window created it or not.
02-25-2003, 03:47 PM
well, that figures...:)
I thought there might be a way since there is a frames-collection, which is supposed to hold all window-objects created by the current document. The problem is how to reach it...
If I create the window like this:
..shouldn't it be possible to access a function in the new window using something like:
The name parameter seems to be different than the frame.name property, though...
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.