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

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?

irt.org | Knowledge Base | JavaScript | Link | Q931 [ previous next ]

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?

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


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.