2012-11-19 32 views
1

我在使用javascript的window.open在Internet Explorer中看到「無效參數」。我將如何解決它?我在「var newwindow = window.open(url,'Popup Demo','toolbar = no,location = no,directories = no,status = no,menubar = no, scrollbars = no,resizable = no,copyhistory = no,width ='+ w +',height ='+ h +',top ='+ top +',left ='+ left);「。IE上的window.open錯誤?

這裏是我的代碼:

<script type="text/javascript" language="javascript"> 
<!-- 

function popitup(url) { 

    var w = 500; 
    var h = 500; 

    var left = (screen.width/2)-(w/2); 
    var top = (screen.height/2)-(h/2); 

    var newwindow = window.open (url, 'Popup Demo', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); 

    if (window.focus) { 
     newwindow.focus(); 
    } 
    return false; 
} 

// --> 
</script> 
+1

爲什麼你有「不要在Netscape 2時代瀏覽器中將此腳本呈現爲文本」的評論?沒有人使用Netscape 2時代瀏覽器。 – Quentin

回答

6

窗口名稱可能沒有空間在IE中。將'Popup Demo'更改爲'PopupDemo'