Chrome 35:document.createEvent(&#39; HtmlEvent&#39;)给出错误<the provided =“”event =“”type =“”('htmlevent')=“”is =“”invalid =“”> < /的>

时间:2014-07-03 05:06:27

标签: javascript google-chrome

使用Chrome 35,在devtools控制台中尝试执行:

document.createEvent('HtmlEvents');

我收到如下错误:

NotSupportedError: Failed to execute 'createEvent' on 'Document': The provided event type ('HtmlEvents') is invalid.

同样适用于Firefox。

1 个答案:

答案 0 :(得分:-1)

编辑

尝试用HtmlEvents代替HTMLEvents,全部大写 HTML

document.createEvent("HTMLEvents");

jsfiddle http://jsfiddle.net/guest271314/Evc5H/