Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Event()

构造函数 Event() 用于创建一个新的事件对象。

语法

 event = new Event(typeArg, eventInit);

参数

typeArg
DOMString 类型,表示所创建事件的名称。
eventInit可选
EventInit 类型的字典,接受以下字段:
  • "bubbles",可选,Boolean类型,默认值为 false,表示该事件是否冒泡。
  • "cancelable",可选,Boolean类型,默认值为 false, 表示该事件能否被取消。

示例

// 创建一个支持冒泡且不能被取消的look事件

var ev = new Event("look", {"bubbles":true, "cancelable":false});
document.dispatchEvent(ev);

规范

Specification Status Comment
DOM
Event()
Living Standard Initial definition.

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
BasicSupport 15 11 (11) 未实现 11.60 Nightly build (535.2)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 11.0 (11) ? ? ?

相关阅读

文档标签和贡献者

标签: 
 此页面的贡献者: Go7hic, Serifx, nuysoft, zhongming2013
 最后编辑者: Go7hic,