Home >Web Front-end >JS Tutorial >javascript 触发HTML元素绑定的函数_javascript技巧

javascript 触发HTML元素绑定的函数_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:19:58963browse
复制代码 代码如下:

if (document.createEvent) {
var clickEvent = document.createEvent("MouseEvents");
clickEvent.initEvent("click", false, true);
this.fileEl.dom.dispatchEvent(clickEvent);//ff
} else if (document.createEventObject) {
this.fileEl.dom.fireEvent("onclick", document.createEventObject(e.browserEvent));//ie
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn