What's the purpose (if any) of “[removed]” in event handler tags?

前端 未结 10 1884
面向向阳花
面向向阳花 2020-12-10 02:26

I\'ve been making a concerted effort to improve my javascript skills lately by reading as much javascript code as I can. In doing this I\'ve sometimes seen the javascr

10条回答
  •  醉梦人生
    2020-12-10 02:44

    The origins of javascript: in an event handler is actually just an IE specific thing so that you can specify the language in addition to the handler. This is because vbscript is also a supported client side scripting language in IE. Here's an example of "vbscript:".

    In other browsers (as has been said by Shadow2531) javascript: is just a label and is basically ignored.

    href="javascript:..." can be used in links to execute javascript code as DannySmurf points out.

提交回复
热议问题