解决了火狐下无法触发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" οnclick="location.href = 'http://www.baidu.com';">baidu</a>
<input type="button" value="clck" οnclick="test2('a3');"/>
标签:FireFox,name,Chrome,true,JavaScript,getElementById,document,evt,click From: https://blog.51cto.com/u_8895844/6152845