HTML 中的锚标记在 IE11 中单击时不起作用

Anchor tag in HTML not working on single click in IE11

本文关键字:IE11 单击 不起作用 HTML      更新时间:2023-09-26

这是我的JSP代码

<td width="25%" align="left" valign="top" class="mainContainer">
    You may start another session by clicking below <a id="loginLink" href="#" onclick="redirectURL()" target="_top"><span>Login</span></a>
</td>  

我的 JS 代码是

function redirectURL(){
    window.location.replace(appContext);
};

它在Mozilla中工作正常,但在IE中,它可以通过双击工作。请帮忙。

锚点跳转不相关。您可以通过停止锚标记的默认功能来禁用它。

<td width="25%" align="left" valign="top" class="mainContainer"> You may start another session by clicking below <a id="loginLink" href="#" onclick="redirectURL(event)" target="_top"><span>Login</span></a> </td>

function redirectURL(event)
{
  event.preventDefault();
  event.stopPropagation();
  window.location.replace(appContext);
};