Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q408 How can I change a value on a form on the original window from a button in a popup window, submit this form, and close the popup window in one step?

You are here: irt.org | FAQ | JavaScript | Form | 10.3 | Q408 [ previous next ]

In the main window:

<script language="JavaScript"><!--
function windowOpen() {
    var myWindow=window.open('popup.html','windowRef','width=200,height=200');
    if (!myWindow.opener) myWindow.opener = self;
}

windowOpen();
//--></script>

<form action="nextpage.html">
<input type="text" value="" name="output">
</form>

In the poup.html dowcument:

<script language="JavaScript"><!--
function updateOpener() {
    opener.document.forms[0].output.value = document.forms[0].input.value;
    opener.document.forms[0].submit;
    window.close();

}
//--></script>

<form onSubmit="updateOpener()">
<input type="text" value="" name="input">
<input type="submit">
</form>

Feedback on 'Q408 How can I change a value on a form on the original window from a button in a popup window, submit this form, and close the popup window in one step?'

©2018 Martin Webb