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

how to access document from a pop up

P: n/a
Hi
I want to set the main document variables from a pop-up.

The code will be somewhat like this (sorry for mistakes) but it isn't
setting the main document's input box value. Please help!

<html>
<head>
<script language="javascript">
function mypopup() {
var win=window.open(...);
var message="<input type=text name=s1 value=yes
onclick=\"document.forms[0].myinput.value='value from popup'\">";
win.document.write(message);
}
</script>
</head>
<form method=post action="myaction.html">
<input type=text name=myinput value='default value' onclick="popup()">
</form>
</body>
</html>

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
VK
(1) in your pop-up:
....
self.opener.myFunction(var1, var2, var3);
....

(2) in the main window:
....
myFunction(v1, v2, v3) {
myVar1 = v1;
myVar2 = v2;
myVar3 = v3;
}
....

Jul 23 '05 #2

P: n/a
On Fri, 01 Jul 2005 17:05:26 -0700, <so***********@yahoo.com> wrote:

You access the parent window by using 'opener', self.opener or
window.opener, from there you can access all objects, document, screen and
any functions or variables or else on it from the child window.

Danny
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.