Click to See Complete Forum and Search --> : Help with targeting parent/pop-up windows


Npessoa
May 3rd, 2003, 02:17 AM
Hi, quick question for the experts here... I'm sure this will seem relatively simple, but I'm having trouble with the javascript grammar.

I need to have a pop-up window whose links will load into the larger parent page. I just put a chromeless (only displays in IE) link-activated pop up on a page in my site and so far I can only get the links to a) open a brand new window or b) load in the tiny pop up itself.

I know this invovles using an "opener" tag, but can someone please describe what I need in each page (for the parent AND child)?

You can see what I'm talking about here:
http://www.katemoennig.net/window_test.html

Click on the 2nd picture, and the pop-up appears. For example, I need the first link (that says "Kate and Erin Sign Autographs at Dinah Shore") to load "dinahshore.html" in the larger parent window.


Thanks so much for your help!!


Nadia

Satishpp
May 5th, 2003, 12:53 PM
In the popup window, when you click a link execute

self.opener.document.url = "yourfile.html";

This will open yourfile.html in the parent window

Satish

Dark Sand
May 5th, 2003, 07:37 PM
You can call this function to change the url of the parent window.


function redirectParent(hyperlink)
{
If(opener)
{
if(opener.closed==false)
{
opener.document.location=hyperlink;
}
}
}


In most cases the Ifs is overkill, but you should still leave them in since you'll get an error when you try to refresh the opener if it doesn't exist or it's been closed.