Solved

Many parent windows affect values in one child window

Posted on 2003-12-01
7
546 Views
Last Modified: 2006-11-17
Dear all,
    How can I have more than one parent window to affect a child window. I plan to have hyperlink in parent window, which when click on can transfer values into the child window. Can I have cases where i have more than one parent window with hyperlinks in it, and no matter which parent window I click, the values will eventually be transfer into the child window???
  Can this be done?

Regards,
Aiya
0
Comment
Question by:aiya
7 Comments
 
LVL 15

Expert Comment

by:Timbo87
ID: 9855548
I set up a test and it looks like the popup window is relative to the parent window that opened it. Therefore a child window popped up from a parent cannot be modified by another non-parent window.
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9855660
If the 2 parent windows are in a frame set then they can both communicate with the popup cretad by one of the windows, is this wht you want.? If the windows are entirely different browser windows then it can not be done unless I believe if you use activeX.

If you have 2 frames named frame1 and frame2 and in frame1 the commoand

win=window.open(''"","","")

then from frame2 you can write to the popoup for instance with

parent.frame1.win.document.write("hi this is from frame 2 ")
0
 
LVL 15

Expert Comment

by:Timbo87
ID: 9855673
Gwyn's solution works if they're in the same frameset. For my test I assumed they were two completely different browser windows.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9855864
This is not going to happen with different browser instances (unless you write some compex activex stuff) but if the parent windows are going to be in the same browser instance it is possible using a hidden frame. I am not sure what you are looking for.
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9855898
ie if say a.htm opens a popup and has a link to b.htm or c.htm then it is possible for b.htm or c.htm to communicate with the popup. Is this what you want ?
0
 

Author Comment

by:aiya
ID: 9856335
okie, the current sounds more like my case... Actually, I have a list of htm that will link to this child window, so watever hyperlinks that I click in the parent window, i want the parent window information to be passed into the child window. How can I go about doing? Can u give me an example? Thanks alot!!! =)
0
 
LVL 10

Accepted Solution

by:
NetGroove earned 0 total points
ID: 9856338
Here my answer: it is possible.

To take Gwin's mnemonic, if you have parents a.htm, b.htm, c.htm,  and one of the opens a popup p.htm, then can every of the parents get access to the popup like this:

a.htm opens the popup:

   window.open('p.htm','popname',height=100,width=100');


The others two, and also the a.htm, can regain the access to popup like this:

   pw = window.open('','popname');
   
The common factor is the window name assigned to the popup.

By the way, in the same manner can also the popup comunicate to any of the parents.
Before the popup can access any of them parent needs the apropriate parent to have a window name.
Window name is a global attribute and can be set like this:

window.name = "Parent1";

So the popup can acces parent one like this:
  p1 = window.open('', "Parent1");

Now can the popup resuse all the object from "Parent1", like form fields, functions, global vars, and so on.




0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now