a通过window.showModalDialog弹出b,想在b中通过一个按钮改变b的地址(例如刷新自己),在firefox和Chrome中都可以,在IE中就会新弹出一个窗口,怎么让它不弹出呢?求高人指点。
附上代码:
a.html:
<html>
<body>
<input type="button" value="test" onclick="test()">
</body>
<script type="text/javascript">
function test()
{
window.showModalDialog("b.html","","");
}
</script>
</html>
b.html
<html>
<body>
<input type="button" value="go to Baidu" onclick="test()">
</body>
<script type="text/javascript">
function test()
{
document.location.href = document.location.href;
}
</script>
</html>

解决方案 »

  1.   

    head里面添加
    <base target="_self"> 
    接分
      

  2.   

    不知道你的浏览器以及jquery版本,我用ie9,切换到ie7、8都没有问题,使用的jquery为http://code.jquery.com/jquery-1.8.0.js这个js
      

  3.   

    sorry,发错帖子了,一会补上
      

  4.   

    ie中测试通过
    b.html改成<html>
    <head>
       <base target="_self"> 
    </head><body>
    <a id="reload" href="b.html" style="display:none">reload...</a>
    <input type="button" value="go to Baidu" onclick="test()"/>
    </body>
    <script type="text/javascript">
    function test()
    {
     var a = document.getElementById("reload");
     a.click();
    }
    </script>
    </html>