This article transferred from: http://www.cnblogs.com/suizhikuo/p/3928411.html
If we want to place the link in the a tag into an empty link, we will generally use two methods:
1
<a href=
"#"
target=
"_blank"
></a>
Or
1
<a href=
"javascript:void(0);"
target=
"_blank"
></a>
The above two methods many people think is the method of empty link, but the two methods are different, what is the difference? Let's talk about it today.
Href= "#" Method:
In fact, the meaning of the empty connection, but after the click will automatically jump to the top of the page, because this method is equivalent to clicking on an anchor, but this anchor is not written ID, so the default jump to the top of the page.
href= "javascript:void (0);" Method:
Void is an operator that specifies that an expression is evaluated but does not return a value. If you write 0 (void (0)) in void, nothing is done and an empty link is formed.
#与javascript: The difference between void (0):
So, #与javascript: the difference between void (0) is also obvious, #方法会跳转到页面的顶部, and there will be # after the page URL, and the Javascript:void (0) method will not, so if it is an empty connection, it is recommended that javascript: void (0).
[Turn]href= "#" and the difference between javascript:void (0)