469,580 Members | 1,888 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,580 developers. It's quick & easy.

Javascript: Problem accessing variables in a parent window from child window

Hi,

I 'm trying to access some fields in the parent window from a child window like this..

Here is my parent Jsp, which has the following script..

Expand|Select|Wrap|Line Numbers
  1. if (window.opener.parent.frames[1]) {
  2.  
  3. var tempDoc = window.opener.parent.frames[1].document;
  4. tempDoc.open();
  5. SubmitWin = tempDoc;
  6. SubmitWin.writeln('<body >');
  7. SubmitWin.writeln('<form name="test" ACTION="<%=jspVirPath%>abc.jsp" METHOD="POST" >');
  8. SubmitWin.writeln ('<input name="data1" type="hidden" value="'+ thisForm.data1.value +'">');
  9. SubmitWin.writeln ('</BODY></HTML>');
  10. SubmitWin.close();
  11. SubmitWin.searchCustId.submit();
  12. }
  13.  
Here is my child window....abc.jsp
I 'm trying to access the the elements in the parent window like INPUTFIELD in the
following way..I 'm getting an error..

Expand|Select|Wrap|Line Numbers
  1. parent.frames[0].document.forms["sabc"].INPUTFIELD.value.....
Please help me...

Thanks
Jenny
Jan 16 '07 #1
1 4136
acoder
16,027 Expert Mod 8TB
The document.forms array expects a number index, so instead of "sabc", specify the form number or just use document.sabc instead.
Feb 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.