Results 1 to 2 of 2
Related
-
Show page from iFrame url in parent window Forum: HTML Forum
Replies: 1 -
Passing value from parent window to child window Forum: Javascript Forum
Replies: 0 -
Frame / Child Window Submission Issues Forum: HTML Forum
Replies: 1
-
06-28-2005, 09:42 AM #1
Accessing a element of parent window in child window
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
-
07-14-2005, 01:41 PM #2
Re: Accessing a element of parent window in child window
replace
alert(window.opener.document.forms[0].txtBox.value)
with
window.opener.FormName.txtBox.value
Hope that helps
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum