reset | onreset event

1 out of 1 rated this helpful - Rate this topic

Fires when the user resets a form.

HTML 4.01 Specification, Section 18.2.3

Syntax

HTML Attribute <element onreset = "handler(event)">
Event Property object.onreset = handler;
addEventListener Method object.addEventListener("reset", handler, useCapture)

Event information

SynchronousNo
BubblesNo
CancelableNo

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

Remarks

Executes associated code.

To invoke this event, do one of the following:

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
address
area
audio
b
base
bdo
body
blockQuote
br
button
canvas
caption
cite
code
col
colGroup
comment
custom
dd
del
div
dl
document
dt
em
embed
fieldSet
form
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
kbd
label
legend
li
link
map
media
meta
object
ol
optGroup
option
p
param
pre
q
rt
ruby
s
samp
script
select
small
source
span
strong
style
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
u
ul
var
video
window
reset

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.