Hai
function disableAnchor(obj, disable)
{
if (disable) {
var href = obj.getAttribute("href");
if (href && href != "" && href != null) {
obj.setAttribute('href_bak', href);
}
obj.removeAttribute('href');
obj.style.color="gray";
}
else {
obj.setAttribute('href', obj.attributes['href_bak'].nodeValue);
obj.style.color="blue";
}
}
or
var Link_Enabled_Flag = false; // disable links - background process changes this to true when it's done
function Check_Link_Enabled(){ return Link_Enabled_Flag; }
<a href="wherever.com" onclick="return Check_Link_Enabled()"></a>
or
IE and Firefox compatible javascript to enable or disable an anchor tag
onclick="disableAnchor(this,'verify')"
function disableAnchor(Check_Obj, Check_Id){
var Anchor_id = 's';
thisCheckbox = document.getElementById(Check_Id);
thisAnchor = document.getElementById(Anchor_id);
if(thisCheckbox.checked){
//alert('Y1');
Check_Obj.setAttribute('href',''); //Check_Obj.attributes['href_bak'].nodeValue
Check_Obj.style.color="blue";
//alert('Y2');
}
else{
//alert('N1');
var href = Check_Obj.getAttribute('href');
//alert(href);
if(href && href != "" && href != null){
Check_Obj.setAttribute('href_bak', href);
}
Check_Obj.removeAttribute('href');
Check_Obj.style.color="gray";
//alert('N2');
}
}