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.
Printable View
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.
try this:
parent.html
child.htmlCode:<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>
Code:<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function doit()
{
opener.document.frm1.txt1.value='Hello World';
}
//--></SCRIPT>
</head>
<body>
<INPUT type=button onClick="doit();">
</body>
</HTML>