Home > Web Front-end > JS Tutorial > Introduction to the difference between the href and onclick events of a tag_Basic knowledge

Introduction to the difference between the href and onclick events of a tag_Basic knowledge

WBOY
Release: 2016-05-16 17:27:53
Original
1049 people have browsed it

1. The onclick event is executed first. If the onclick event returns a false value, the href will no longer be executed.
2. href="#" defaults to the anchor point #top, so the page will jump to the top when there is a scroll bar. The best solution is href="javascript:void(0);".
3. The returned content in href will flush out the information of the current page.

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