There is no difference between return func()
and return func();
The semicolon will be added on the fly if it isn't there. Same obviously goes for the other examples.
return func()
invokes func()
and returns (the "return" part is a little complicated, but it involves bubbling and it overrides the default behavior for clicks, I believe. Returning true
tells the browser to invoke the default behavior (like going to a link's target, for example), and returning false disables the default behavior. I'm not entirely sure what it'll do if it returns anything else.
javascript:func()
is (almost) the same as func()
-- but it's an outdated way to do it. Don't use this.
func()
is almost the same as the others, but it can cause some problems with bubbling and default behavior. Usually, you'll want to specify either return true;
or return false;
return true
doesn't do much of anything. It just tells the browser "do what you were already going to do." Returning false, on the other hand, would disable default behavior.
In conclusion, the first six will basically do the same thing, the seventh will just invoke the default behavior.