When using <a href= onclick=>, some problems arose, which confused me for more than a month. Now I have obtained the following conclusion from netizens, which makes me suddenly enlightened and the problem is solved.
The linked onclick event is executed first, followed by the actions 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 actions under the href attribute not to be executed, onclick must get a false return value;
If the page is too long and there are scroll bars and you want to perform the operation through the linked onclick event. Its href attribute should be set to javascript:void(0); instead of #, which prevents unnecessary page jumps;
If a function with a return value is called in the linked href attribute, the content of the current page will be replaced by the return value of this function;
There will be a difference when you hold down the Shift key.
The problem I encountered today is that parentNode cannot be accessed in IE6.0 as href.
Try not to use the javascript: protocol as A's href attribute, which will not only cause unnecessary triggering of the window.onbeforeunload event, but will also stop playing gif animation images in IE.