[Javascript] Return value from popup
Marsie Welch
mjwelch at adelphia.net
Wed Mar 5 20:57:47 CST 2003
Thanks. Sorry it was so obvious. I created a form at one time, but who
knows where it went. It really helped to have a fresh pair of eyes.
Marsie
----- Original Message -----
From: "Peter Brunone" <peter at brunone.com>
To: <javascript at LaTech.edu>
Sent: Wednesday, March 05, 2003 4:34 PM
Subject: RE: [Javascript] Return value from popup
Marsie,
Two problems come to mind. One, you don't have a form in your popup
window, so you can't refer to it. Two (and this may not matter, but it's
good coding practice), you probably want to avoid using reserved words to
name objects... like naming an input "input".
Cheers,
Peter
-----Original Message-----
From: javascript-admin at LaTech.edu On Behalf Of Marsie Welch
Sent: Wednesday, March 05, 2003 3:06 PM
To: javascript at LaTech.edu
Subject: [Javascript] Return value from popup
I'm trying to create a form that opens a popup and then transfers the value
entered in a popup form, back to the form that opened the popup.
I get the error message:
Error: 'document.forms.0.input' is null or not an object
Any help would be appreciated. Here is my code:
THE SIMPLE "MAIN" FORM
<html>
<head>
<title>Simple Form</title>
</head>
<body>
<script language="JavaScript">
<!--
function windowOpen() {
var
myWindow=window.open('popup.htm','windowRef','width=200,height=200');
if (!myWindow.opener) myWindow.opener = self;
}
//--></script>
<input name="openPopup" type="button" id="openPopup"
onClick="Javascript:windowOpen();" value="Get Value" />
<form name="form1" id="form1" method="post" action="">
<input type="text" value="" name="output"></input>
</form>
</body>
</html>
THE POPUP FORM (popup.htm)
<html>
<head>
<title>The Popup</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<script language="JavaScript"><!--
function updateOpener() {
window.opener.document.forms[0].output.value =
document.forms[0].input.value;
window.close();
}
//-->
</script>
EventId:
<input type="text" name="input"></input>
<input name="Close" type="submit" id="Close"
onClick="Javascript:updateOpener()" value="Close"></input>
</body>
</html>
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list