【发布时间】:2011-05-23 17:01:52
【问题描述】:
我在 InnovaStudio WYSIWYG 编辑器 (5.3) 中有一个 iframe 的“弹出”窗口。它用于将导航链接放置到文本中。单击链接后,弹出窗口应关闭。
此代码适用于除 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()
标签: javascript jquery