1 <script language="javascript">
2 function test2(name)
3 {
4 if(document.all)
5 {
6 document.getElementById(name).click();
7 }
8 else
9 {
10 var evt = document.createEvent("MouseEvents");
11 evt.initEvent("click", true, true);
12 document.getElementById(name).dispatchEvent(evt);
13 }
14 }
15 </script>
1 <a href="#" id="a3" onclick="location.href = 'http://www.baidu.com';">baidu</a>
2 <input type="button" value="clck" onclick="test2('a3');"/>