views:

180

answers:

3

Hi,

Are all popups the same when it comes to referencing the parent pages js variables/methods etc?

How about ajax requests from within the popup's content?

From what i understand a popup is just playing with the Z-order, so its basically still on the parents page just looks 'higher' right?

+1  A: 

Most likely you're talking about a popup being a div (or other element) being displayed when an action occurs. this is done by having some sort of hidden element on the page that just gets displayed and maybe centered, then brought to the front (using the z-index).

if this is how you're using popup's with javascript then yes, all javascript that's on the page is accessible to the popup.

John Boker
how is centering done?
John Boker
A: 

You will have to be cognizant of cross-domain scripting. However, for the simplest cases, you should be able to reference javascript on the parent page with:

if (window.parent)
{
    window.parent.SomeFunctionOnParent();
}
Joel Potter
A: 

Javascript popups are independent windows but they can refer to their owner via: window.owner

thenduks