1、JS
var comment = document.getElementsByTagName('a')[0];
if (document.all) {
// For IE
comment.click();
} else if (document.createEvent) {
// 在ff中要为a标签添加click事件,并且侦听该事件
var ev = document.createEvent('MouseEvents');
ev.initEvent('click', false, true);
comment.dispatchEvent(ev);
}
2、JQuery
$("#aid").trigger(“click”);
文章转自:https://blog.csdn.net/itchiang/article/details/7912807
更多参考:https://blog.csdn.net/qq_35432904/article/details/103061763