Microsoft KB Archive/253579

= BUG: DISABLED Attribute Does Not Disable Hyperlinks =

Article ID: 253579

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q253579



SYMPTOMS
Although the DISABLED attribute is set to true for a hyperlink, as in the following, Where do you want to go today? users can still click on the hyperlink and Internet Explorer navigates to the selected page.



RESOLUTION
To resolve this problem, set an onclick event for the hyperlink that returns either true or false depending on the current execution context. The following code sets the value of a global Microsoft JScript variable to true or false, depending on a button click. The target hyperlink object's DISABLED property is updated so that it can properly communicate its disabled status to other objects and script functions on the page.

Workaround for DISABLED Attribute Problem



var canNav = false;

function canNavigate { return canNav; }

function load { document.all("btn1").innerText = "Link status == " + canNav; }

function setNavigate(linkObj, canNavParam) { if (linkObj != null) { if (canNavParam == false) { linkObj.disabled = true; } else { linkObj.disabled = false; }       canNav = canNavParam; } }

function updateBtnStatus(btnName) { var btn = document.all(btnName); if (btn != null) { document.all(btnName).innerText = "Link status == " + canNav; } }





Click here





STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

