jquery - 如何在 iframe 之外打开对话框

标签 jquery user-interface iframe dialog

我在 iframe 中调用 jQueryUI 对话框,如下所示:

enter image description here

但我需要 iframe 之外的对话框(例如 window.parent ----> 打开对话框 或类似的东西)。

最佳答案

首先,您需要在 parent 中初始化对话框,并将 autoOpen 设置为 false(如果是这种情况)。

$("#dialog").dialog({ autoOpen: false });

您可以通过在表达式之前添加 parent. 从 iframe 打开它:

parent.$("#dialog").dialog("open");

关于jquery - 如何在 iframe 之外打开对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21390054/

相关文章:

javascript - 如何将两个单选按钮的输入分配给单个字段?

java - 如何在 JTextField 中显示字符数组

vba - VBA 消息框中的可选文本

c++ - 从资源 ID 获取 CButton 控件名称?

Python selenium 在多个 iframe 中定位元素

php - 在 IE 和 Safari 中提交表单时,Iframed 页面出现 session 过期问题

javascript - 统一 iframe 内呈现的独立页面的路由 Urls

javascript - 如何在加载图片(在网络中)时向用户显示 gif 动画?

c# - ASMX 网络服务不返回 JSON,只能使用 application/x-www-form-urlencoded contentType 进行 POST

jquery - 使用自己的图像更改 jQuery UI 按钮的图标