A href = "javascript:" With a href = "#",
<a href="javascript:;"></a> <a href="#"></a>
These two methods. What are the differences between the two statements? Which one is used to write more standards?
Connecting href = "#" means connecting to the current page is meaningless, and the page will not be refreshed. This is an anchor link.
When creating a webpage, the parameters in the html language are used to specify the url ### of the link, that is, the link to this page, and href = "Address" is the link to this page. The default page is displayed, A new window is not displayed. If # is removed when the connection is null, the mouse and hand cursor are not displayed. In general, a fake link pointing to this page can also be followed by the anchor id. This is actually another usage of bookmarks.
Syntax: <a href = "# bookmark name"> link text </a>
Bookmarks linked to different pages
Syntax: <a href = "link file address # bookmarkname"> link text </a> (note the quotation marks and)
Under normal circumstances, click the <a href = "# bookmark name"> link text </a> link, the cursor will automatically jump to the following page: <a name = "bookmarkname"> text </a>.
If we just want to write a tag without any event jump. I personally do not recommend using <a href = "#">.
However, the href attribute can also identify javascript code segments.
Javascript: a pseudo-protocol. It allows us to call javascript Functions through a link. However, because this function is empty, we call an empty function without any material changes. You can also click and run the tag. If there is a large amount of content in the page and the upper and lower scroll bars are available, using href = "#" will cause the jump to the top of the page. Use href = "javascript:;" to avoid page jumps!
Therefore, if we want to write a dead a tag, use
<a href="javascript:;"></a>
It will be more conducive to increasing the user friendliness of our pages!