diff options
Diffstat (limited to 'files/zh-tw/web/api/event/createevent/index.html')
-rw-r--r-- | files/zh-tw/web/api/event/createevent/index.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/files/zh-tw/web/api/event/createevent/index.html b/files/zh-tw/web/api/event/createevent/index.html new file mode 100644 index 0000000000..fd60d1089d --- /dev/null +++ b/files/zh-tw/web/api/event/createevent/index.html @@ -0,0 +1,29 @@ +--- +title: Event.createEvent() +slug: Web/API/Event/createEvent +translation_of: Web/API/Document/createEvent +--- +<p>{{APIRef("DOM")}}</p> + +<p>建立一個新的事件,該事件必須先以其 <code>init()</code> method 初始化才行。</p> + +<h3 id="語法">語法</h3> + +<pre><code>document.createEvent(type) </code></pre> + +<dl> + <dt><code>type</code></dt> + <dd>一個 string 。表示所建立的事件名稱。</dd> +</dl> + +<p>這個 method 會回傳一個新的 DOM {{ domxref("Event") }} object ,其事件類型為傳入的 type 。該事件必須先初始化才能使用。</p> + +<h3 id="範例">範例</h3> + +<pre class="brush: js">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> |