What is href=[removed];

前端 未结 8 1063
天命终不由人
天命终不由人 2020-12-31 18:42

in a code which i am goin through there is a link has href=javascript:; in code.when it is clicked it opens a lightbox to show some msg with close button.how is it done.I th

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 19:10

    It's known as the javascript pseudo-protocol. It was designed to replace the contents of the document with a value calculated by JavaScript. It's best not to use it, for several reasons, including:

    • If JavaScript is disabled, you have a link that goes nowhere
    • If your JavaScript returns a value, the contents of the page will be replaced by that value

    More reasons why you shouldn't use it

提交回复
热议问题