javascript触发HTML元素绑定的函数_javascript技巧
时间:2021-07-01 10:21:17
帮助过:2人阅读
代码如下:
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
}