触发a标签

var aLink = document.createElement("a");
        aLink.download = '';
        aLink.href = url;
        if (document.createEvent) {
            var e = document.createEvent('MouseEvents');
            e.initEvent('click', true, true);
            aLink.dispatchEvent(e);
        } else if (a.fireEvent) {
            aLink.fireEvent('onclick');
        };

 

posted on 2019-02-20 15:47  weblsy  阅读(179)  评论(0编辑  收藏  举报