href= "javascript:;"

Source: Internet
Author: User

1. The href attribute of the label specifies that the value of the Url,href property of the hyperlink can be an absolute or relative URL for any valid document, including fragment identifiers and JavaScript code fragments;

1 <a id= "wrap" href= "javascript:;" > Enter Password </a>

2, javascript: is a pseudo-protocol, the other pseudo-protocol also has mail:tel:file:

JavaScript: Represents a piece of code that executes when clicked, and javascript:; means nothing happens when clicked, so there's nothing to do when you click

1 document.getElementById (' wrap '). AddEventListener (' Click ', Fumction (e) {2    E.preventdefault (); 3    // when <a> triggers, processing business 4 },false);

JAVASCRIPR: is to remove the default behavior of <a> tags, and href= "javascript:void (0)"; Void is an operator of JavaScript, void (0) means nothing.
3, in simple terms, "javascript:" "is another kind of nested JS code in the Web page way, and through the tag to add the same JS code, but it is not recommended to use

If you click on the link below, JavaScript will be executed: the following code

1 <a href= "Javascripe:alert (22);" > Click here </a>

href= "javascript:;"

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.