浏览器事件归类

 1 var link = document.getElementById("myLink");
 2 //only IE
 3 link.onclick = function() {
 4     window.event.returnValue = false;
 5 };
 6 
 7 //DOM0
 8 link.onclick = function(event) {
 9     event.preventDefault();
10 };
11 
12 //DOM事件监听
13 link.addEventListener("click", function(event) {
14     event.preventDefault();
15 });
16 
17 //IE事件监听
18 link.attachEvent("onclick", function() {
19     window.event.returnValue = false;
20 });
posted @ 2012-05-28 10:17  小猩猩君  阅读(139)  评论(0编辑  收藏  举报