The linked onclick event is executed first, followed by the action under the href attribute (page jump, or javascrip{filter}t pseudo-link); Assuming that there is both href and onclick in the link, if you want to prevent the action under the href property from being executed, onclick must get a false return value. If you don't believe me, you can comment out return false in the goGoogle function; If the page is too long with a scroll bar and you want to perform an action via the linked onclick event. Its href property should be set to javascrip{filter}t:void(0); , not #, which prevents unwanted page bounces; If you call a function with a return value in the linked href property, the content of the current page will be replaced by the return value of this function; There is a difference when holding down the Shift key. The problem I encountered today is that the parentNode cannot be accessed in the form of href in IE6.0. Try not to use the javascrip{filter}t: protocol as the href attribute of A, which will not only cause unnecessary triggering of the window.onbeforeunload event, but also stop the animation gif in IE
Here is what I encountered:
If you don't set the href attribute, it will not respond to hover under IE6. Double-clicking will select the tag's parent container instead of this one-a tag (this is a problem in IE). <a href="javascirpt:fn(this)"> <a> Suppose we have an fn method that needs to fetch this element, and the first method passes in this is null.
Therefore, the recommended way to write it is <a href="javascrip{filter}t:void(0)">
|