<a href='index.html' onclick='index()' >链接</a>
If there are both href and onclick in the a tag, the above writing method, onclick is executed first, href is executed after (page jump), but when there may be href jump, the click event handler has not yet taken effect;
Methods to prohibit href execution:
(1) href='javascript:void(0)', only the onclick event is executed at this time, it is recommended to use it when the href is not linked;
(2) onclick execution, returns false, href does not execute;
But we often use href = '#' to abbreviate empty links, click a link, '#' will be appended to the end of the url; and the page will be at the top;