--


Accessing a element of parent window in child window

by

 
Hi,

Below is a function in my aspx page called Parent.aspx.I'm calling it on click event of a button on this page.
function fnParentFrmSubmit()
{
document.body.insertAdjacentHTML("beforebegin","<input type=text id='txtBox' value='Y'>");
document.Form1.submit();
}

<input type="button" value="Submit" id="btnSubmit" onclick="javascript:fnParentFrmSubmit()">

...And the below function is in another page called Child.aspx which I'm calling on Page_Load event

function fnChildWinLoad()
{
alert(window.opener.document.forms[0].txtBox.value) }

When the user clicks on the submit button,I am submitting the form thru' client side javascript and then in the code behind

of this page,I am opening a Child.aspx using Response.write("<script language='javascript'>window.open(Child.aspx,'abcd')")

I am creating a textbox element dynamically and then trying to access its value in the child element.
But I am getting javascript error 'window.opener.document.forms[0].txtBox.value' is not an object or is null.
I tried using window.opener.document.getElementById("txtBox").value,but still I get the same javascript error.

Any idea where am I going wrong..??

Thanks in advance..

Regards,
livehed



Posted on Jun 28, 2005, 9:32 AM

Respond to this message

Goto Forum Home

Find more forums on JavaCreate your own forum at Network54
 Copyright © 1999-2009 Network54. All rights reserved.   Terms of Use   Privacy Statement