【解决】document.getelementbyid("XX").click失效

var card=document.getElementById('login-link');
    		if(document.createEvent){
	    		var ev = document.createEvent('HTMLEvents');
	    		ev.initEvent('click', false, true);
	    		card.dispatchEvent(ev);
    		}
    		else card.click();

你可能感兴趣的:(js,document,click)