Under what circumstances to add [javascript:]

You know http: // https: // mailto: tencent: // What kind of thing? This is called url schema, usually of a href inside.
But a href inside of the script is not added, the browser creates a schema called javascript and put a href the inside, such as <a href = "javascript: alert ();" so the browser will think it It is a period to execute the script instead of a browser link.
Other events, such as onclick onkeydown etc. handler, the browser know for sure is the script, it is not in fact added plus javascript :( no problem, javascript will be interpreted as a label only)

Guess you like

Origin www.cnblogs.com/FengZeng666/p/11621522.html