3] onClick=”return function(‘value’);”
Well to start of,
Not in HTML, but as braces cause problems with XML parsers you are encouraged to use only external scripts in XHTML.
Please stop just making things up. Its a pseudo-protocol identifier because it’s aping the protocol part of a URL and it applies to a construction such as:
If you are coding of IE, it will work on all the version as it’s IE is very forgiving in terms of standards
2] Second, onClick=”function(‘value’);”
But, this function will not return any value, which will cancel that event.
If you write
, here submit button will never submit form, as function is returning false.
But in above 2nd example, it will work as it doesn’t return any value.
3] Third, onClick=”return function(‘value’);”
As mention above, whenever you need to return value to the event, you will use return keyword with the function.
If some object is return, it doesn’t mean any of this value null, undefined, false and 0, and engine will evaluate true.
So, here the point is whatever your function return, and as long it’s not null, undefined, false, 0. Event won’t cancel and would be executed.
If you want more elaborate way of canceling the event, you could write