What is the Difference between onclick and href="[removed]function name?

前端 未结 6 924
夕颜
夕颜 2021-02-10 11:55

Is there any difference between

1 : Link1

and

2 : 

        
6条回答
  •  眼角桃花
    2021-02-10 12:37

    There is a difference in functionality, the first doesn't attempt to process a link. The second does.

    However, I agree with Coronatus - both methods are not ideal. I would suggest researching unobtrusive JavaScript (perhaps with jQuery) as you could dynamically add a click event to the element.

提交回复
热议问题