Click to See Complete Forum and Search --> : identifying parent/child window


ocbazgi
10-23-2003, 02:50 PM
Hi all. I'm using a script to open a child window and building the content by pulling the head and a particular div from the parent window. There are scripts embedded within the div section that must run only in the parent window, not the child window. So, a simple statement is needed that basically says "if this script loads into a child window, don't run it. If it's loaded into a parent window, run it". What I don't know is how to identify the child window as a child. I can give the window a name when I open it, but how do I access that name in my script (like window.name or something...). Any info would be appreciated, thanks.

Jona
10-23-2003, 08:13 PM
Parent


<script type="text/javascript"><!--
var child = window.open("child_window.html","child","width=200,height=300");

function alertSomething(something){
alert(something);
}
//--></script>


Child (popup)


<script type="text/javascript"><!--
opener.alertSomething("I am an open child");
//--></script>


[J]ona