reset Method

Internet Development Index

Simulates a mouse click on a reset button for the calling form.

Syntax

FORM.reset()

Return Value

No return value.

Remarks

The reset method fires the onreset event on the form.

Example

This example demonstrates how to use the reset method for a form object. When the button is pressed, the form is reset, resulting in the onreset event call on the form object. The onreset event calls an event handler which in turn adds the text Resetting form. to the text area below.

<HTML>
<HEAD>
<SCRIPT>
function doReset(){
oTextArea1.value += "Resetting form.  ";
}
</SCRIPT>
</HEAD>
<BODY>
<DIV id="oDiv1"
style="border:1px solid black; background:#EEEEEE; padding:10px;">
<B>Form</B>
<FORM name="form1" onreset="doReset();">
<b>Enter some text:</b> <INPUT type="text" name="oText1" value=""><BR><BR>
<BUTTON onclick="form.reset();">form.reset()</BUTTON>
</FORM>
</DIV>
<B>Text area</B><BR>
<TEXTAREA id="oTextArea1" value="" rows="5" cols="75"></TEXTAREA>
</BODY>
</HTML>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

FORM