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

Q480 How do I pass the value of a text field when the submit button is pressed onto the next page?

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

Use the following on the source page:

<form onSubmit="return false">
<input type="text" name="textName">
<input type="button" value="Go" onClick="window.location.href = 'nextpage.html?' + this.form.textName.value">
</form>

And the following on the nextpage.html:

<form name="formName"><input type="text" name="textName"></form>
<script language="JavaScript"><!--
document.formName.textName.value = location.search.substring(1);
//--></script>

Or, alternatively:

<script language="JavaScript"><!--
document.write("<form><input type='text' ");
document.write("value='"+location.search.substring(1)+"'></form>");
//--></script>

Feedback on 'Q480 How do I pass the value of a text field when the submit button is pressed onto the next page?'

©2018 Martin Webb