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

前端 未结 10 1943
面向向阳花
面向向阳花 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:40

    Basically, is there any appreciable difference between: onchange="javascript: myFunction(this)" and onchange="myFunction(this)" ?

    Assuming you meant href="javascript: myFunction(this)", yes there is, especially when loading content using the javascript. Using the javascript: pseudo protocol makes the content inaccessible to some humans and all search engines, whereas using a real href and then changing the behaviour of the link using javascript makes the content accessible if javascript is turned off or not available in the particular client.

提交回复
热议问题