Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Form 10.3 | Q480 [ previous next ]

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

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.