解决了火狐下无法触发click事件的问题
<script language="javascript"> function test2(name) { if(document.all) { document.getElementById(name).click(); } else { var evt = document.createEvent("MouseEvents"); evt.initEvent("click", true, true); document.getElementById(name).dispatchEvent(evt); } } </script> <a href="#" id="a3" onclick="location.href = 'http://www.baidu.com';">baidu</a> <input type="button" value="clck" onclick="test2('a3');"/>