PDA

Click to See Complete Forum and Search --> : Parent Child relation


msdnexpert
Dec 14th, 2000, 01:02 PM
Dear all,
I have a parent browser window which invokes another browser window(the child). Is it possible for me to transfer some data from the child window back to a text field in the parent window? A code snippet would be great.

Mark Sreeves
Dec 15th, 2000, 05:13 AM
try this:

parent.html

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function newWindow(file,window) {
msgWindow=open('',window,'resizable=no,width=200,height=200');
msgWindow.location.href = file;
if (msgWindow.opener == null) msgWindow.opener = self;
}
//--></SCRIPT>
</HEAD>
<body>
<FORM name=frm1>
<INPUT TYPE="button" VALUE="Open New Window" onClick="newWindow('child.html','window2')">
<BR>


<INPUT NAME="txt1">
</FORM>

</body>
</HTML>



child.html

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function doit()
{

opener.document.frm1.txt1.value='Hello World';


}
//--></SCRIPT>

</head>
<body>
<INPUT type=button onClick="doit();">


</body>
</HTML>