【问题标题】:jQuery UI Dialog - How to open dialog from a link in iframejQuery UI 对话框 - 如何从 iframe 中的链接打开对话框
【发布时间】:2011-07-14 11:03:11
【问题描述】:

我想从 iframe 链接打开一个对话框,但是我不能让它弹出一个对话框 有人知道原因吗?

我在 html 中有一个 iFrame <iframe src="Add_Reviewer.html" width="100%" name="test" frameborder="0" scrolling="auto" height="100%"></iframe>

我在 Add_Reviewer.html 中的链接 <a href="#" id="advance_add">Advance Add</a>

我的 jQuery 代码

var $advance_add = $('<div></div>')
    .html('<iframe src="Advance_Add.html" width="100%" name="test" frameborder="0" scrolling="auto" height="100%">')
    .dialog({
        autoOpen: false,
        bgiframe: true,
        width:650,
        minWidth: 650,
        height: 550,
        closeOnEscape:true,
        modal:true,
        title: 'Addvance Add',
        buttons : {

                    "Close" : function() {
                                  $(this).dialog("close");
                                          }
        }
    });

$("#advance_add").click(function(e) {

    e.preventDefault();     
$advance_add.dialog('open');

});

【问题讨论】:

  • 您是在 iFrame 或父文件中加载 jQuery + jQuery UI 吗?

标签: jquery user-interface iframe dialog


【解决方案1】:

我正在使用此代码:

$("#advance_add").click(function() {
    $('<iframe src="Advance_Add.html" frameborder="0" />').dialog({
        modal: true,
        dialogClass: 'priceBox',
        title: 'Your title',        
        height: 400,
        width: 500,
        draggable: false,
        resizable: false});
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-04
    • 2013-06-25
    • 2012-11-10
    • 1970-01-01
    相关资源
    最近更新 更多