2011-03-16 115 views
2

我很難在IE中使用它。所有其他瀏覽器都能正常工作!由於此鏈接正在循環背景圖片中使用,因此無法使用透明gif。如果我放置一個gif,它不會循環...任何建議?在IE瀏覽器中onclick =「window.open」問題

<div onclick="window.open('mylink.html','new_window');" style="display:block; float:right; height:40px; width:100px; cursor:pointer;"> 

+0

傷心,你沒有在所有瀏覽器的問題... – jondavidjohn 2011-03-16 18:43:01

+0

描述發生了什麼,詳細。 – 2011-03-16 18:43:46

+0

我們在談論什麼IE版本? – thedev 2011-03-16 18:50:30

回答

2

我相信,IE仍然只觸發從通常可點擊元素的onclick事件。

這樣做:

<a href="#" onclick="window.open('mylink.html','new_window'); return false" style="display:block; float:right; height:40px; width:100px; cursor:pointer; text-decoration:none"> 

(當然使用相應</a>,而不是</div>末)

不知道什麼透明的gif有什麼關係。

+0

是的,IE是唯一一個沒有解決問題的人。改變我的結構,並使用類似於您發佈的內容。 thx老兄! – detonate 2011-03-17 18:55:35

+0

我也試圖在窗口名稱中加一個連字符來燒幾分鐘。除了IE以外的其他地方工作。 – technoTarek 2013-10-19 21:11:00

0

檢查你的IE設置,看是否彈出窗口是允許的。

click事件在IE 8是否正確解僱

演示:http://jsfiddle.net/R249t/

+0

主要針對IE6 ...還沒有找到解決方案 – detonate 2011-03-16 19:16:35

+0

Internet Explorer 6幾乎死亡,市場份額低於5%(2010年6月)...我認爲,如果您的腳本適用於IE7並且以後您的安全:) – thedev 2011-03-16 19:33:17

+0

最後一件事情:) ...嘗試用大寫字母C – thedev 2011-03-16 19:36:23

1

對於鏈接,我更喜歡使用標籤<a>

<a href="mylink.html" target="_blank" style="display:block; float:right; height:40px; width:100px; cursor:pointer;"> Your link </a> 

你甚至可以把<a> <img .... /> </a> 之間的圖片不要忘記在添加樣式:文字修飾:無;

+0

由於jQuery圖像週期,圖像沒有運氣,它選擇了並將其包含在循環部分中。 Thx給予一些建議米奇,欣賞! – detonate 2011-03-17 18:56:23