Home > Web Front-end > HTML Tutorial > Disabled attribute of hyperlinkDisabledLearn_html/css_WEB-ITnose

Disabled attribute of hyperlinkDisabledLearn_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:00:52
Original
2275 people have browsed it

You can set the hyperlink's Disabled attribute to true and false to determine whether the hyperlink can be clicked

For example:
bai du

The above means that you don’t want bai du’s hyperlink to take effect, but when click Without any constraints and judgments, when you click Baidu, it will naturally jump to the Baidu page. This is the bug of disabling attributes of hyperlinks in HTML
You can add the following js constraints to determine whether the hyperlink can be used


The following bug solution provided by Microsoft:
With the help of global variables, use other buttons to change the disabled attribute to get disabled Effect of the attribute.;

BUG: The DISABLED attribute no longer disables hyperlinks
Although the DISABLED attribute is set to True a hyperlink is in the following,
Where do you want to go today?
Users can still click the hyperlink and Internet Explorer navigates to the selected page.

To resolve this issue, set the onclick event of the hyperlink to return true or false based on the current execution context. The following code sets the value of a global Microsoft JScript variable to true or false , depending on the button click. The DISABLED property of the target hyperlink object is updated so that it can properly communicate its disabled state to other objects and scripting functionality on the page.


Workaround for DISABLED Attribute Problem
<SCRIPT> <br>var canNav = false; <br>function canNavigate () { <br>return canNav; <br>} <br>function load() { <br>document.all("btn1").innerText = "Link status == " canNav; <br>} <br> <br>function setNavigate(linkObj, canNavParam) { <br>if (linkObj != null) { <br>if (canNavParam == false) { <br>linkObj.disabled = true; <br>} else { <br>linkObj.disabled = false; <br>} <br>canNav = canNavParam; <br>} <br>} <br><br>function updateBtnStatus(btnName) { <br>var btn = document.all(btnName) ; <br>if (btn != null) { <br>document.all(btnName).innerText = "Link status == " canNav; <br>} <br>} <br></SCRIPT>



Click here





Reference: http://support.microsoft .com/kb/253579/zh-cn

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template