Feedback on: irt.org FAQ Knowledge Base Q408
Worth:
Worth reading
Comments:
There are a few typos in this article. The script does not execute, I receive the error message, "opener.forms[0] is not an object." I would love to be able to execute this script.
Thanks Kevin
Worth:
Worth reading
Length:
Just right
Technical:
Just right
Comments:
I had to change opener.forms[0] to opener.document.forms[0]
and opener.forms[0].submit to opener.forms[0].submit()
to get the code to work
Comments:
I expected that the code provided would allow me to
* open a page (main.html)
* enter data in the field in popup.html
* Submit form on popup.html
* The form on main.html should be automatically submitted and I should see nextpage.html
This doesn't work in IE5 NN4.01 NN4.72.
Any ideas?
main.html
_________________________________
<html>
<head>
<script language="JavaScript">
function windowOpen() {
var myWindow=window.open('popup.html','windowRef','width=200,height=200');
if (!myWindow.opener) myWindow.opener = self;
}
windowOpen();
</script>
</head>
<body>
<form action="nextpage.html">
<input type="text" value="" name="output">
</form>
</body>
</html>
popup.html
________________________________________
<html>
<head>
<script language="JavaScript">
function updateOpener() {
opener.document.forms[0].output.value = document.forms[0].input.value;
opener.document.forms[0].submit;
window.close();
}
</script>
</head>
<body>
<form onSubmit="updateOpener()">
<input type="text" value="" name="input">
<input type="submit">
</form>
</body>
</html>
nextpage.html
__________________________________
<html>
<head>
</head>
<body>
Next page
</body>
</html>
Comments:
I expected that the code provided would allow me to
* open a page (main.html)
* enter data in the field in popup.html
* Submit form on popup.html
* The form on main.html should be automatically submitted and I should see nextpage.html
This doesn't work in IE5 NN4.01 NN4.72.
Any ideas?
main.html
_________________________________
<html>
<head>
<script language="JavaScript">
function windowOpen() {
var myWindow=window.open('popup.html','windowRef','width=200,height=200');
if (!myWindow.opener) myWindow.opener = self;
}
windowOpen();
</script>
</head>
<body>
<form action="nextpage.html">
<input type="text" value="" name="output">
</form>
</body>
</html>
popup.html
________________________________________
<html>
<head>
<script language="JavaScript">
function updateOpener() {
opener.document.forms[0].output.value = document.forms[0].input.value;
opener.document.forms[0].submit;
window.close();
}
</script>
</head>
<body>
<form onSubmit="updateOpener()">
<input type="text" value="" name="input">
<input type="submit">
</form>
</body>
</html>
nextpage.html
__________________________________
<html>
<head>
</head>
<body>
Next page
</body>
</html>