aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 12:56:40 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 12:56:40 +0100
commit310fd066e91f454b990372ffa30e803cc8120975 (patch)
treed5d900deb656a5da18e0b60d00f0db73f3a2e88e /files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.gz
translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.bz2
translated-content-310fd066e91f454b990372ffa30e803cc8120975.zip
unslug zh-cn: move
Diffstat (limited to 'files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html')
-rw-r--r--files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html93
1 files changed, 93 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html b/files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html
new file mode 100644
index 0000000000..edc74b2306
--- /dev/null
+++ b/files/zh-cn/conflicting/web/api/eventtarget/dispatchevent/index.html
@@ -0,0 +1,93 @@
+---
+title: EventTarget.fireEvent()
+slug: Web/API/EventTarget/fireEvent
+translation_of: Web/API/EventTarget/dispatchEvent
+translation_of_original: Web/API/EventTarget/fireEvent
+---
+<p>{{APIRef("DOM Events")}}</p>
+
+<p>{{ Non-standard_header() }}</p>
+
+<h2 id="概述">概述</h2>
+
+<p>这是微软IE浏览器用以替代{{domxref("EventTarget.dispatchEvent()")}}的私有方法,与{{domxref("EventTarget.dispatchEvent()")}}不同的是通过<code>fireEvent()</code> 触发的事件不会触发事件的默认行为,例如,通过fireEvent()触发&lt;input type="checkbox"&gt;的点击事件并不会切换checkbox的选中状态</p>
+
+<p>语法</p>
+
+<pre class="syntaxbox"><em>cancelled</em> = <em>target</em>.fireEvent(<em>eventNameWithOn</em>, <em>event</em>)
+</pre>
+
+<dl>
+ <dt>target</dt>
+ <dd>要触发事件的元素</dd>
+ <dt>eventNameWithOn</dt>
+ <dd>要触发事件的名字,前缀为“on”,例如,可以用过"onclick"来触发点击事件</dd>
+ <dt>event</dt>
+ <dd>要触发的事件对象</dd>
+ <dt>cancelled</dt>
+ <dd>布尔值,事件是否被事件句柄取消</dd>
+</dl>
+
+<h2 id="规范">规范</h2>
+
+<p>无此部分的规范</p>
+
+<p>微软的描述: <a href="https://msdn.microsoft.com/en-us/library/ms536423(v=vs.85).aspx">has a description on MSDN</a>.</p>
+
+<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatNo() }}</td>
+ <td>6 到 10 [1]</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatNo() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatNo() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1]: fireEvent()在IE11+已经不再支持,{{domxref("EventTarget.dispatchEvent()")}}在IE9+已经支持</p>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li><a href="http://help.dottoro.com/ljvtddtm.php">Dottoro Web Reference article</a></li>
+</ul>