【发布时间】:2014-10-18 19:20:11
【问题描述】:
我在我的 jquery ui 对话框中显示 iframe。在对话框内,我正在显示添加/编辑等操作的表单。我正在使用以下 HTML 代码:
@* This is container which is open as popup *@
<div id="dialog">
<iframe frameborder="0" id="ContentIframe" src=""></iframe>
</div>
CSS 是:
#ContentIframe {
border: medium none;
height: 100%;
width: 100%;
float:left;
}
而jquery代码是这样的:
/* This method opens iframed dialog box */
function ShowPopup(Url, DialogTitle, W, H) {
/* Setting for dialog box */
$("#dialog").dialog({
title: DialogTitle,
autoOpen: false,
modal: true,
resizable: false,
width: W,
height: H,
open: function (ev, ui) {
/* Setting URL to open in iframe */
$('#ContentIframe').attr('src', Url);
}
});
/* Opening dialog box */
$('#dialog').dialog('open');
}
当调用 ShowPopup 方法时,我通过 URL 在弹出窗口中打开。这很好用,但问题是,当我打开说 URL-A 然后关闭弹出窗口然后尝试在与 URL-B 相同的页面上打开弹出窗口时,首先显示以前的 URL-A 的内容,然后在几秒钟后显示 URL-B 的新内容.我认为它是在 iframe 中打开的,所以下一个 URL 需要一些时间来加载,但是为什么旧的(以前的)URL 的内容仍然存在,因为我已经关闭了弹出窗口。
在此先感谢...
【问题讨论】:
标签: jquery jquery-ui iframe popup