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 });