EDIT:
Long story short: assuming link is assigned to your link:
link.href = null;
will disable the link entirely.
I got excited and posted too quickly. Here's what you want :)
var links = document.links || document.anchors || document.getElementsByTagName('a'); for (var i = 0, j = links.length; i < j; i++) { addEvent(links[i], 'click', disable); } function disable(evt) { var e = evt || window.event, link = (e.currentTarget) ? e.currentTarget : e.srcElement; checkLetter(link.innerHTML); link.href = null; return false; } function addEvent(element, myEvent, fnc) { return ((element.attachEvent) ? element.attachEvent('on' + myEvent, fnc) : element.addEventListener(myEvent, fnc, false)); }
This code also assumes you removed javascript:checkLetter('A') from your link's href="". Instead, I call it inside the function using the letter that it is (link.innerHTML)
a:visitedinstead ofa.visitedbut it'll hide the link, not deactivate it