Home > Web Front-end > HTML Tutorial > Jump to the address pointed to by href after the click event of html hyperlink a_HTML/Xhtml_Web page production

Jump to the address pointed to by href after the click event of html hyperlink a_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:38:56
Original
1753 people have browsed it

Sometimes, we need to use the hyperlink instead of using href to complete the jump, but like this: . In this way, the page will not jump. But it will also bring some negative problems, such as the title of the page changing to "#", or scroll bars appearing on the page. This is because after executing the onClick event, jumps to the address pointed to by the href again, and "#" is an anchor point, which defaults to the top of the web page, so it will cause the problems mentioned above.

There are two solutions:

1. Add a return false statement to the onClick event, for example:

Click

2 , use void(0) instead of #, for example:

Click

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template