aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/globaleventhandlers/onreset/index.html
blob: 43b947544c33a92791b5f4a5749c68460c968bd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: GlobalEventHandlers.onreset
slug: Web/API/GlobalEventHandlers/onreset
translation_of: Web/API/GlobalEventHandlers/onreset
---
<p>{{ ApiRef() }}</p>

<p>The <code><strong>GlobalEventHandlers.onreset</strong></code> 属性包含 {{event("Event_handlers")}} ,当收到一个{{event("reset")}} 事件时触发</p>

<h2 id="Syntax" name="Syntax">语法</h2>

<pre>window.onreset = funcRef;
</pre>

<h3 id="Parameters" name="Parameters">参数</h3>

<ul>
 <li><code>funcRef</code> 是一个函数的引用.</li>
</ul>

<h2 id="Example" name="Example">例子</h2>

<pre class="eval">&lt;html&gt;
&lt;script&gt;
function reg() {
  window.captureEvents(Event.RESET);
  window.onreset = hit;
}

function hit() {
 alert('hit');
}
&lt;/script&gt;

&lt;body onload="reg();"&gt;
 &lt;form&gt;
   &lt;input type="reset" value="reset" /&gt;
 &lt;/form&gt;
 &lt;div id="d"&gt; &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>

<h2 id="Notes" name="Notes">备注</h2>

<p>reset 事件只有在用户点击表单中的reset按钮时才会被触发 (<code>&lt;input type="reset"/&gt;</code>).</p>

<h2 id="Specification" name="Specification">规范</h2>

<table class="spectable standard-table">
 <tbody>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">评论</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onreset','onreset')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>