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

Q838 How can I reset the value of form fields if the page is revisted?

You are here: irt.org | FAQ | JavaScript | Form | 9 | Q838 [ previous next ]

Use HTML to provide a default value:

<FORM NAME="myForm">
<INPUT TYPE="TEXT" VALUE="">
</FORM>

<SCRIPT LANGUAGE="JavaScript"><!--
document.myForm.reset();
//--></SCRIPT>

If that doesn't work then:

<FORM NAME="myForm">
<INPUT NAME="myField" TYPE="TEXT">
</FORM>

<SCRIPT LANGUAGE="JavaScript"><!--
document.myForm.myField.value = '';
//--></SCRIPT>

©2018 Martin Webb