Fires when the user resets a form.
![]() |
Syntax
| HTML Attribute | <element onreset = "handler(event)"> |
|---|---|
| Event Property | object.onreset = handler; |
| attachEvent Method | object.attachEvent("onreset", handler) |
| addEventListener Method | object.addEventListener("reset", handler, useCapture) |
Event information
| Synchronous | No |
|---|---|
| Bubbles | No |
| Cancelable | No |
Event handler parameters
- pEvtObj [in]
-
Type: IHTMLEventObj
Standards information
- HTML 4.01 Specification, Section 18.2.3
Remarks
Executes associated code.
To invoke this event, do one of the following:
- Click an input type=reset button.
- Invoke the reset method of the form object.
The pEvtObj parameter is required for the following interfaces:
- HTMLAnchorEvents2
- HTMLAreaEvents2
- HTMLButtonElementEvents2
- HTMLControlElementEvents2
- HTMLDocumentEvents2
- HTMLElementEvents2
- HTMLFormElementEvents2
- HTMLImgEvents2
- HTMLFrameSiteEvents2
- HTMLInputFileElementEvents2
- HTMLInputImageEvents2
- HTMLInputTextElementEvents2
- HTMLLabelEvents2
- HTMLLinkElementEvents2
- HTMLMapEvents2
- HTMLMarqueeElementEvents2
- HTMLObjectElementEvents2
- HTMLOptionButtonElementEvents2
- HTMLScriptEvents2
- HTMLSelectElementEvents2
- HTMLStyleElementEvents2
- HTMLTableEvents2
- HTMLTextContainerEvents2
- HTMLWindowEvents2
Examples
This example demonstrates how to use the onreset event for a form object. Reset the form by clicking the first or second button. The only difference between the two buttons is that the second button invokes the reset method of the form object and the first button is of input type=reset. When either 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.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onreset.htm
<HTML>
<HEAD>
<SCRIPT>
function doReset(){
oTextArea1.innerText += "Resetting form. ";
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="form1" onreset="doReset();"
<B>Form</B><BR>
style="border:2px solid #cccccc; background:#EEEEEE; padding:10px; ">
<b>Enter some text:</b>
<INPUT type="text" name="oText1" value=""><BR><BR>
<INPUT TYPE="reset" value="Input type=reset"/>
<BUTTON onclick="form.reset();">form.reset()</BUTTON>
</FORM>
<B>Form status</B><BR>
<SPAN id="oTextArea1" ></SPAN>
<BR><BR>
<BUTTON onclick="location.reload(true);">Refresh Page</BUTTON>
</BODY>
</HTML>
See also
- a
- abbr
- acronym
- address
- applet
- area
- audio
- b
- base
- baseFont
- bdo
- bgSound
- big
- body
- blockQuote
- br
- button
- canvas
- caption
- center
- cite
- code
- col
- colGroup
- comment
- custom
- dd
- del
- dfn
- dir
- div
- dl
- document
- dt
- em
- embed
- fieldSet
- font
- form
- frame
- frameSet
- head
- hn
- hr
- html
- i
- iframe
- img
- input type=button
- input type=checkbox
- input type=file
- input type=hidden
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- isIndex
- kbd
- label
- legend
- li
- link
- listing
- map
- marquee
- media
- menu
- meta
- nextID
- noBR
- noFrames
- noScript
- object
- ol
- optGroup
- option
- p
- param
- plainText
- pre
- q
- rt
- ruby
- s
- samp
- script
- select
- small
- source
- span
- strike
- strong
- style
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- title
- tr
- tt
- u
- ul
- var
- wbr
- video
- window
- xmp
- reset
Send comments about this topic to Microsoft
Build date: 1/23/2013
