window.location.href 失效的解决办法

第一种:在window.location.href 后面加上 window.event.returnValue = false;

如:

<a href="#" onclick="window.location.href='http://www.microsoft.com';
   window.event.returnValue=false;">

第二种:

把window.location.href写成 JavaScript:window.location.href

如:

<a href="JavaScript:window.location.href='http://www.microsoft.com';">

第三种:

不写 href 直接写onlick .然后通过css样式来控制鼠标移上去显示手型效果.

如:

<a onclick="window.location.href='http://www.microsoft.com';"   onmouseover="window.status='http://www.microsoft.com';"    onmouseout="window.status='';"   Apple-converted-space"> font-family:times new roman">
原文地址:https://www.cnblogs.com/dachuang/p/4475743.html