gpt4 book ai didi

jquery - 如何使用 Iframe 关闭 jQuery 对话框

转载 作者:行者123 更新时间:2023-12-01 04:17:02 25 4
gpt4 key购买 nike

我为对话框创建了一个 div 并在 div 内加载了一个 iframe

我的问题是我无法通过单击带有 aspx 页面的 iframe 中的按钮来关闭对话框。

我尝试了下面的代码。如果我直接使用 iframe 作为对话框而不是 div,它就可以工作,但它会为调整大小/拖动对话框和 iframe< 带来其他问题.

window.parent.$('#divdialog').dialog('close');

赞赏此问题的可行解决方案。

最佳答案

谢谢大家..终于我找到了解决方案。

这是 iframe 中使用的代码:-

window.parent.CloseDialog();

这是父页面中使用的代码:-

var divdialog = $('#divdialog'); divdialog.dialog('destroy');
divdialog.dialog({
autoOpen: true,
height: 310,
width: 570,title: "Look Up",
modal: true,
open: function () {$('#testframe').attr("src", strValue);
$('#testframe').height($(this).height()-5); $('#testframe').width($(this).width()-10);
},
close: function (e) {
$('#divdialog').remove();
},
resizable: true,
resize: function() { $('#divdialog iframe').hide(); },
resizeStop: function() { $('#divdialog iframe').show();
$('#divdialog iframe').height($(this).height()-10);
$('#divdialog iframe').width($(this).width()-10); } ,
closeOnEscape:true,
draggable:true
})

function CloseDialog()
{
$('#divdialog').dialog('close'); return false;
}

关于jquery - 如何使用 Iframe 关闭 jQuery 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14013226/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com