The difference between the href and the onclick JavaScript is generally useless to the attention, but the error is somewhat depressed, read this chapter explains the following:
Had always been very casual, later see. NET LinkButton seems to be used in <a href= "Javascript:fun ();" The form of ...>,
Today in this way encountered some problems, pick the Netizen's article and my conclusions placed below:
- linked
onclick
event is executed first, followed by href
Properties Action (page jump, or JavaScript
- If is present in the link,
href
and onclick
, if you want to href
The action under the property does not execute, onclick
must get a false
return value. Do not believe, you can gogoogle
function return false
comment out;
- if the page is too long with scroll bars, And you want to perform the action through the linked
onclick
event. It should be href
property set to javascript:void (0);
, not #
, This prevents unnecessary page jumps;
- if a function with a return value is called in the linked
href
property, the contents of the current page will be replaced by the return value of the function;
- There is a difference when you hold down the SHIFT key.
- The problem I encountered today, IE6.0 in the form of href access to parentnode.
- Try not to use JavaScript: protocol as the HREF attribute of a, which not only leads to unnecessary triggering of window.onbeforeunload events, but also makes GIF animated pictures stop playing in IE.