📌  相关文章
📜  锚元素 onclick 不起作用 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:55.553000             🧑  作者: Mango

代码示例1
//Onclick event of anchor tag won't work if href is set.
//Workaround: make href call a function that does onclick and then redirects page to link address
//NOT GOOD: Link 
//BETTER: Link 
function onLinkClick()
{
  doSomething();
  window.location.href = "/info";
}