This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

reset

Method of dom/HTMLFormElementdom/HTMLFormElement

Syntax

var object = object.reset();

Return Value

Returns an object of type DOM NodeDOM Node

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

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>

View live example

Notes

Remarks

The reset method raises the onreset event on the form. The reset method fires the onreset event on the form.

Syntax

Standards information

See also

Related pages

  • form

Attributions