FireFox与IE 下js兼容触发click事件的代码
发布时间:2016-12-30 来源:查字典编辑
摘要:functiontest(){document.location.href="DBAI_les20_globalization_suppor...
<a href="#" id="a3"></a>
<input type="button" value="clck"/>
<script language="javascript">
function test()
{
document.location.href = "DBAI_les20_globalization_support.ppt";
}
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>