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

Q931 Is it possible to pass the the value of a form input text field from one page to another, and display the value as normal text?

You are here: irt.org | FAQ | JavaScript | Link | Q931 [ previous next ]

Yes. In the first page:

<script language="JavaScript"><!--
function nexpage() {
    location.href = 'page2.htm' + '?' +  escape(document.myForm.textField.value);
    return false;
}
//--></script>

<form name="myForm" onSubmit="return nextpage()">
<input type="text" name="textfield">
<input type="submit">
</form>

And then in page2.htm:

<script language="JavaScript"><!--
var dataPassed = '';

if (location.search.length > 0)
    dataPassed = unescape(location.search.substring(1));

document.write(dataPassed);
//--></script>

Feedback on 'Q931 Is it possible to pass the the value of a form input text field from one page to another, and display the value as normal text?'

©2018 Martin Webb