怎样"取消"或"禁止"点击超级链接

解决方案 »

  1.   

    obj = document.getElementById("a_id");
    obj.href = "";
    or
    obj.href = "javascript:void(0);";
      

  2.   

    <a href="#" id="a1" onclick="alert('ddddd');document.location.href='http://www.baidu.com'">asdasdasd</a>
    <input name="button1" type="button" value="禁止" onclick="document.getElementById('a1').onclick=null;document.getElementById('a1').href='javascript:void(0)'">
    <input name="button1" type="button" value="不禁止" onclick="document.getElementById('a1').onclick=function(){alert('aaa');document.location.href='http://www.baidu.com';document.getElementById('a1').href='#'}">