我在InnovaStudio所見即所得編輯器(5.3)中有一個iframed「彈出式」窗口。它用於放置從導航到文本的鏈接。點擊鏈接後,彈出窗口應該關閉。IE9和self.close()
此代碼的工作,除了Internet Explorer 9的所有瀏覽器:
$('#InternalLinkSelector').find('a').click(function(e) {
e.preventDefault();
$this = $(this);
(opener ? opener:openerWin).oUtil.obj.insertLink($this.attr('href'), $this.html(), null, null);
self.close();
});
彈出有它在調用ISWindow.objs['
UNIQUE_ID_STRING '].close();
上角自己的關閉按鈕。我試圖重寫代碼使用ISWindow
,但它表現出相同的行爲,在所有瀏覽器中工作,但IE9:
$('#InternalLinkSelector').find('a').click(function(e) {
e.preventDefault();
$this = $(this);
(opener?opener:openerWin).oUtil.obj.insertLink($this.attr('href'), $this.html(), null, null);
// Find the window object to close it
for (var i in top.ISWindow.objs) {
if ('function' == typeof top.ISWindow.objs[i].close) {
top.ISWindow.objs[i].close();
}
}
});
您是否嘗試過'window.close()' – Eduardo 2011-05-23 17:12:22