diff options
Diffstat (limited to 'files/zh-cn/conflicting/web/api/document/createevent/index.html')
-rw-r--r-- | files/zh-cn/conflicting/web/api/document/createevent/index.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/api/document/createevent/index.html b/files/zh-cn/conflicting/web/api/document/createevent/index.html new file mode 100644 index 0000000000..84d91c4dec --- /dev/null +++ b/files/zh-cn/conflicting/web/api/document/createevent/index.html @@ -0,0 +1,36 @@ +--- +title: Event.createEvent() +slug: conflicting/Web/API/Document/createEvent +tags: + - DOM + - Event + - JavaScript + - Method +translation_of: Web/API/Document/createEvent +translation_of_original: Web/API/Event/createEvent +original_slug: Web/API/Event/createEvent +--- +<p>{{APIRef("DOM")}}</p> + +<p>创建一个新的事件(Event),随之必须调用自身的 init 方法进行初始化。</p> + +<h3 id="语法">语法</h3> + +<pre><code>document.createEvent(type) </code></pre> + +<dl> + <dt><code>type</code></dt> + <dd>指明待创建事件对象的类型的字符串</dd> +</dl> + +<p>此方法返回一个新的特定类型的 DOM {{ domxref("Event") }} 对象,此对象在使用前必须经过初始化(init)。</p> + +<h3 id="示例">示例</h3> + +<pre>var newEvent = document.createEvent("UIEvents");</pre> + +<h3 id="规范">规范</h3> + +<ul> + <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-document" title="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-document">DOM Level 2 Events</a></li> +</ul> |