Javascript代码打开一个不在IE中工作的新窗口

时间:2011-08-01 16:41:14

标签: javascript html internet-explorer

我的网站上有一些代码,当用户点击链接时,它会打开一个新窗口。

在Chrome和Firefox中一切正常,但在IE中无效。

这是我在页眉中的代码:

<script type="text/javascript">
function popopen()
{
    newwindow = window.open("page.html","Title",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=660,height=620');
}
</script>

这是链接上的代码:

<a href="javascript: popopen()">Click to open the popup</a>

如何让它在IE中正常工作?

谢谢!

1 个答案:

答案 0 :(得分:7)

那是因为窗口的名称(JewishMusic Stream)有空格! (其他浏览器允许,但IE 6,7&amp; 8不允许)

你在第151行:

function popopen()
{
    newwindow = window.open('http://jewishmusicstream.com/player.html','JewishMusic Stream','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=660,height=620');
}

应该是:

function popopen()
    {
        newwindow = window.open('http://jewishmusicstream.com/player.html','JewishMusicStream','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=660,height=620');
    }