Disabled properties for Hyperlinks disabled use examples _javascript tips

Source: Internet
Author: User

You can set the hyperlink's Disabled property to True and false to determine if the hyperlink is clickable

For example:

<a herf= ' http://www.baidu.com ' onclick= ' return click (this); ' disabled= ' ture ' >bai du</a>

The above means do not want to let the Bai du the hyperlink effective, but click Do not make any constraints and judgments, but click Bai du will naturally jump to Baidu page, which is the HTML hyperlink disabled properties of the bug
You can add the following JS constraint to determine whether a hyperlink can be used

<script language= ' javascript ' > 
function click (obj) 
{ 
if (obj.disabled) 
{return 
false; 
} return 
ture; 
} 
</script>

The following is a bug solution from Microsoft:

With the help of global variables, use other buttons to change the properties of the disabled to get the effect of disabling the property.;

The Bug:disabled property does not disable a hyperlink
Although the DISABLED property is set to True a hyperlink is in the following,
<a disabled= "true" href= "http://www.microsoft.com/" rel= "external nofollow" rel= "external nofollow" >where do Want to go today?</a>
Users can still click a hyperlink, and then Internet Explorer navigates to the selected page.

To resolve this issue, set the OnClick event that returns TRUE or false based on the hyperlink for the current execution context. In the following code, the value of the global Microsoft JScript variable is set to True or false and is hit by a button. The DISABLED property of the target Hyperlink object is updated so that it can communicate its disabled state correctly, other objects, and write the functionality on the script page.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.