Compatibility issues in Firefox and IE using href=”javascript;void(0);" in a tag

Under Firefox and IE, href="javascript:void(0) will pop up a blank page.
After investigation, it is found that href="javascript:void(0);" causes the problem. The
original purpose of javascript:void(0); Refresh the web page and return a null value, but because of the bubbling event of the DOM itself, the javascript:void(0); in the HREF attribute will be executed last, causing the execution function to return a null value, so it overwrites the previous normal execution function. Error caused by the returned value.

Under normal circumstances, IE will first run the events bound to the DOM itself, such as ONCLICK; if the bubbling is not prevented, the HREF attributes will be executed sequentially. If you want to run correctly, you can use RETURN FALSE in front to stop bubbling, for example:

<a target="_blank" class="prev" οnclick="return false;"   href="javascript:void(0);"></a>
或者直接删去也行,如:
<a target="_blank" class="prev"></a>

Guess you like

Origin blog.csdn.net/qq_37514029/article/details/84992549