How to prevent hyperlink jump when using a link_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:38:44
Original
1730 people have browsed it

When using , some problems arose, which confused me for more than a month. Now I got the following conclusion from netizens, which made me suddenly enlightened and the problem was solved.

The onclick event of the link is executed first, followed by the action under the href attribute (page jump, or javascript pseudo-link);
Assuming that there are both href and onclick in the link, if you want the href attribute to The action is not executed, onclick must get a false return value;
If the page is too long and has a scroll bar, and you want to perform the operation through the link's onclick event. Its href attribute should be set to javascript:void(0); instead of #, which can prevent unnecessary page jumps;
If a function with a return value is called in the href attribute of the link, the current page The contents of will be replaced by the return value of this function;
will make a difference when holding down the Shift key.
The problem I encountered today is that I cannot access parentNode in the form of href in IE6.0.
Try not to use javascript: protocol as the href attribute of A. This will not only cause unnecessary triggering of the window.onbeforeunload event, but will also stop the playback of animated gif images in IE.

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