2011-04-26 45 views
11

我有一個簡單的日曆彈出窗口出現時日曆上的日期點擊。下面的代碼適用於Opera,FF和Chrome,但不適用於IE6-8。它出現在底部的Error on Page,並顯示錯誤invalid argumentwindow.open錯誤只在IE瀏覽器 - 無效的參數

<div class="day-number">1</div> 
<td class="calendar-day" onclick="window.open('http://www.cal.com/admin/editevents.php?day=2&month=4&year=2011', 
'Edit Events', 'scrollbars=1,width=600,height=475');"> 

有人可以幫助我,發現我做的對,但錯誤根據IE?

+1

可能重複[window.open在IE7-8-9b中拋出無效參數](http://stackoverflow.com/questions/4840369/window-open-throws-invalid-argument-in-ie7-8-9b ) – 2011-04-26 13:18:51

+0

@Pekka可能只是問題不同而已。問這個問題時也沒有提出這個問題。 – 2011-04-26 13:23:13

+0

上面的評論是由系統自動創建的,當一個人投票結束一個問題作爲另一個副本時。這並不意味着你沒有搜索到的指責:)但它清楚*是重複的。 – 2011-04-26 13:24:57

回答

32

窗口名稱不應有空格。試試EditEvents

+0

偉大的我現在會嘗試。 – 2011-04-26 13:27:29

+7

剛剛發現它也不喜歡連字符' - ' – 2013-08-09 13:54:17

+6

IE永遠不會結束讓我逗樂...... – Kreker 2013-09-09 14:16:17

1
window.open(theURL,winName,features); 

例如:window.open('google.com','Edit Events','width=100'); //false

window.open('google.com','EditEvents','width=100'); //True 

=> 編輯活動//假

EditEvents //真正

=> winName沒有空格。

相關問題