Let the hyperlink after click Do not jump, you can use the href = "#", but this # will anchor to the top of the page click on the link after you do not jump can be set to

Source: Internet
Author: User

Let the hyperlink not jump after the click, you can use the href = "#", but this # will anchor to the top of the page
After clicking the link does not jump can be set to
1.<a href= "javascript:void (0);" >javascript:void (0);</a>
2.<a href= "javascript:;" >javascript:;</a>
3.<a href= "" onclick= "return false;" >return false;</a>
4.<a href= "#" onclick= "return false;" >return false;</a>
5.<a href= "# #" >##</a>
6.<a href= "# # # >####</a>
7.<a href= "#all" > #all </a>
If you want to click the hyperlink call JS method can be set to
1.<a href= "javascript:void (0)" onclick= "Jsfun ()" >jsFun</a>
2.<a href= "#" onclick= "Jsfun (); return false;" >jsfun (); return false;</a>
3.<a href= "#" onclick= "alert (1); event.returnvalue=false;" >alert (1);event.returnvalue=false;</a>

1.javascript:void (0) not recommended
2. Link (href) direct use of javascript:void (0) in IE may cause some problems, such as: Cause GIF animation to stop playback, so the safest way is to use "# # #". To prevent clicking on a link and jumping to the top of the page, the OnClick event will return false.
3. If you just want to move the mouse over, turn into a hand, you can use
<span style= "Cursor:pointer" onclick= "Jsfun ()" > Hand type!</span>

Let hyperlinks do not jump after the click, you can use the href = "#", but this # will anchor to the top of the page after clicking on the link will not jump can be set to

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.