By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,885 Members | 1,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,885 IT Pros & Developers. It's quick & easy.

obtaining field Id from the parent window in pop up window using window.opener

P: 1
Hi Guys,

I am trying to get the Field Id from the Parent Window in the pop up window using window.opener ex:

Expand|Select|Wrap|Line Numbers
  1.    var var1 = window.opener.document.getElementById("text1").value;
  2.   alert(var1);
I also used as window.opener.document.loginForm.text1.value but the field value is not getting in the pop up window. What am i missing here. Please let me know what i am missing here.


Thanks,
Kalyan
May 22 '07 #1
Share this Question
Share on Google+
5 Replies


P: 1
Hope this will work for you
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.     alert(opener.document.getElementById('txtDetailsURL').value);
  3. </script>
I used it's working fine.

Regards,
Muhammad Rizwan Javed
Software Engineer
Mechtechnologies, Lahore Pakistan
Jun 19 '07 #2

Arockalypse
P: 25
You are right Ali i use this too its very good!!!
Apr 12 '08 #3

acoder
Expert Mod 15k+
P: 16,027
I am trying to get the Field Id from the Parent Window in the pop up window using window.opener ex:

Expand|Select|Wrap|Line Numbers
  1.    var var1 = window.opener.document.getElementById("text1").value;
  2.   alert(var1);
I also used as window.opener.document.loginForm.text1.value but the field value is not getting in the pop up window. What am i missing here. Please let me know what i am missing here.
The things that could be missing are that it's not being correctly referenced, or it can't access it, e.g. parent window is closed. The best thing to do is check the error console in a decent browser (unless it affects one browser only).
Apr 12 '08 #4

acoder
Expert Mod 15k+
P: 16,027
Hope this will work for you
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.     alert(opener.document.getElementById('txtDetailsURL').value);
  3. </script>
I used it's working fine.
That might work for you, but it assumes that there is an element with an id of "txtDetailsURL" which the OP probably won't have and it's very similar to the original code anyway.

Also note that the language attribute of the script tag has been deprecated in favour of the type attribute:
[html]<script type="text/javascript">[/html]
Apr 12 '08 #5

acoder
Expert Mod 15k+
P: 16,027
You are right Ali i use this too its very good!!!
Er... who's Ali?
Apr 12 '08 #6

Post your reply

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