[转载]window.location.href 失效的解决办法

    xiaoxiao2023-07-13  139

    原文地址:window.location.href 失效的解决办法 作者:rapheal_Guo

    window.location.href 有时会失效..这又是万恶的IE的BUG..

     

    微软上公布3个解决方案的.

    原文地址:http://support.microsoft.com/kb/190244/en-us

    第一种:

    在window.location.href 后面加上 window.event.returnValue = false;

    如:

    <a href="#" οnclick="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 οnclick="window.location.href='http://www.microsoft.com';"   οnmοuseοver="window.status='http://www.microsoft.com';"     οnmοuseοut="window.status='';"   style="cursor:pointer; text-decoration:underline; color:blue;     font-family:times new roman"> 相关资源:敏捷开发V1.0.pptx
    最新回复(0)