Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Parent windows


Message #1 by "Imar Spaanjaars" <Imar@S...> on Fri, 30 Mar 2001 11:48:01
Hi there,

Thanks for your reply. Unfortunately, this is not what I am after.
First of all, window.open will return a reference to the child window. But 
in my case this won't help: I can't open the window with window.open() 
because I am submitting a form to a new window by setting the target to 
_blank. (See below, in my previous message).

Therefore, the window.opener is not available.

Anybody any other ideas on how to reference the parent window??

Imar




At 09:21 AM 3/30/2001 -0500, you wrote:
>You need the handle of the parent window, not the name of the window.  This
>is generally done by using:
>
>hwnd = window.open();
>
>hwnd.focus();
>...
>..
>.
>
>
>
>-----Original Message-----
>From: Imar Spaanjaars [mailto:Imar@S...]
>Sent: Friday, March 30, 2001 6:48 AM
>To: javascript
>Subject: [javascript] Parent windows
>
>
>Hi there,
>
>I have a question regarding referencing parent windows from a child window.
>
>On a page, I open a new window by submitting a form and setting _blank as
>the target for the post-action. By doing this, I loose control of the
>parent window, because this way, the window.opener is unavailable.
>
>However, I can get a reference back to the parent window my specifying the
>window.name property inside the parent, like this:
>
>(in page 1)
>     <script language="JavaScript">
>     <!--
>         window.name = "wndParent";
>     //-->
>     </script>
>
>(in page2)
>     <a href="http://www.somewhere.com/" target="wndParent">Open</a>
>
>This example will load the requested page inside the parent window. But,
>how do I get access to the parent with script?? I need to set focus on the
>window, amongst other actions, but this doesn't work:
>
>     wndParent.focus();
>
>Any ideas??
>
>
>Imar


  Return to Index