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

Q369 How can I pass the name entered in a text box to a popup window for display when the form button is pressed?

You are here: irt.org | FAQ | JavaScript | Window | Q369 [ previous next ]

In the main window:

<SCRIPT LANGUAGE="JavaScript"><!--
function passData(data) {
    windowHandle = window.open('apage.html' + '?' + data,'windowName','resizable=no,width=200,height=200');
}
//--></SCRIPT>

<FORM onSubmit="return false">
<INPUT TYPE="TEXT" NAME="data">
<INPUT TYPE="BUTTON" VALUE="Pass Data" onClick="passData(this.form.data.value)">
</FORM>

then in the apage.htm:

<SCRIPT LANGUAGE="JavaScript"><!--
if (location.search.length > 0) document.write('Hi ' + location.search.substring(1));
//--></SCRIPT>

©2018 Martin Webb