Possible Duplicate:
What is “javascript:” in a javascript event handler?
I see a lot of code like the following:
<span onclick="javascript:alert('blah');">blah</span>
I doubt people understand what it's actually doing and I guess since it is required (as a URI scheme) in the following, people just assume it is required elsewhere?
<a href="javascript:alert('blah');">blah</a>
I.e. presumably they assume it is specifying the language of the event handler, but you can't actually specify vbscript:
(or any other language) at that point.
It isn't really a problem to include the javascript:
, but it does nothing as it is actually just labeling the block (as the target for a non-existent break
or continue
statement).
Is there a historical reason why people add the javascript:
? Are there some browsers where it makes/made a difference or is it just a misunderstanding?