Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Child Window Function

Status
Not open for further replies.

pwillia3

Programmer
Apr 29, 2002
10
US
Is it possible to call a member function on a global object that lives in a child window?

Example:
Parent A - Calls window.open("Child B", "child);

Child B - Contains object X

Parent A - Calls X.function(); <-- Is this possible in any way?


Thanks,
Patrick
 
try windowName.document.X.function();
where window name is the windowHandler attached to window.open (windowName = window.open("...", "..."));
 

Failing that, use the handle returned by the window.open method:

Code:
var winHandle = window.open(...);

I think that you would use either:

Code:
winHandle.objName.objMethod();

or

Code:
winHandle.document.objName.objMethod();

Hope this helps,
Dan
 
Nothing worked unless I declared X in Child B like this:

document.X = ...
 

If you declare X as a global variable (e.g. var X = 0;) in the popup window, the methods described above should work, I believe.

Dan
 
Yea I tried that and it didn't work. That was the first thing I tried.

Thanks for the help. I decided to scrap the idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top