right click on html link which execute javascript

后端 未结 1 726
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 08:44

When i click a link, i want to execute a javascript function to get the dynamic url. So i did like below.

 a link 

        
相关标签:
1条回答
  • 2021-01-24 08:55

    Short answer: No, you can't.

    But since you are using JS anyways, you can just use it to change the href attribute in <a, so by the time the user clilcks on the link, it's already pointing to the right URL.

    0 讨论(0)
提交回复
热议问题