تصدير (0) طباعة
توسيع الكل
EN
هذا المحتوى غير متوفر بلغتك ولكن ها هو الإصدار باللغة الإنجليزية.

reset | onreset event

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;
attachEvent Method object.attachEvent("onreset", handler)
addEventListener Method object.addEventListener("reset", handler, useCapture)

 

Event information

SynchronousNo
BubblesNo
CancelableYes

 

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

Remarks

Executes associated code.

To invoke this event, do one of the following:

The pEvtObj parameter is required for the following interfaces:

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


<!DOCTYPE html>
<html>
<head>
  <title>onreset Event Sample</title>
</head>
<body style="overflow: hidden">
  <h1>onreset Event Sample</h1>
  <p>This example demonstrates how to use the <strong>onreset</strong> event for a <strong>FORM</strong> object. 
    Reset the form by clicking the first button <em>(Input type=reset)</em> or second button <em>(form.reset())</em>. 
    The only difference between the two buttons is that the second button invokes the <strong>reset</strong> method of the 
    <strong>FORM</strong> object and the first button is of <em>input type=reset</em>. When either button is pressed the 
    <strong>FORM</strong> resets, resulting in the <strong>onreset</strong> event call on the <strong>FORM</strong> object. 
    The <strong>onreset</strong> event calls an event handler which in turn adds the text "<em>Resetting form.</em>" to the text area below.</p>
  <form name="form1" onreset="doReset();" style="border: 2px solid #CCC; background: #EEE; padding: 10px;">
    <strong>Form</strong><br>
    Enter some text:
    <input type="text" name="oText1" value=""><br>
    <br>
    <input type="reset" value="Input type=reset" />
    <button onclick="form.reset(); return false;">form.reset()</button>
  </form>
  <strong>Form status</strong>
  <p><span id="oTextArea1"></span></p>
  <p>&nbsp;</p>
  <button onclick="location.reload(true);">Refresh Page</button>
  <script>
    function doReset() {
      document.getElementById('oTextArea1').textContent += "Resetting form.  ";
    }
  </script>
</body>
</html>

See also

a
abbr
acronym
address
applet
area
audio
b
base
baseFont
bdo
bgSound
big
blockQuote
body
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=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
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
video
wbr
window
xmp
reset

 

 

إظهار:
© 2014 Microsoft