var toggleClickableLink = (function (){
var stopHandler = function ( e ) { e.preventDefault && e.preventDefault() || (window.event.returnValue = false); };
return document.addEventListener ? function ( linkObj ) {
linkObj[ (linkObj.isDisable ? "remove" : "add") + "EventListener" ]("click", stopHandler, false);
linkObj.isDisable = !linkObj.isDisable;
} : function ( linkObj ) {
linkObj[ (linkObj.isDisable ? "de" : "at") + "tachEvent" ]("onclick", stopHandler);
linkObj.isDisable = !linkObj.isDisable;
};
})();
toggleClickableLink( document.getElementById("myLink") );//запрещаем переход
toggleClickableLink( document.getElementById("myLink") );//возвращаем возможность перехода
|