0

How can I remove/hide menu header from the popup modal dialog from url?

var iframe = $('<iframe frameborder="0" marginwidth="0" marginheight="0" allowfullscreen id="frameIdcustomer"></iframe>');
        var dialog = $("<div></div>").append(iframe).appendTo("body").dialog({
            autoOpen: false,
            modal: true,
            resizable: false,
            width: "auto",
            height: "auto",               
            close: function () {
                iframe.attr("src", "");
            }
        });
        $("#btn_newCustomer").on("click", function AddCust(e) {
            e.preventDefault();
            var src = "../MasterPages/CustomerMaster.aspx";
            var title = "Customer Master";
            var width = "980";
            var height = "530";
            iframe.attr({
                width: +width,
                height: +height,
                src: src
            });                
            dialog.dialog("option", "title", title).dialog("open");
            $("#frameIdcustomer").contents().find("#menuheaderr").hide();
        });

I tried $("menuheader").hide() but it's not working.

$("#frameIdcustomer").contents().find("#menuheaderr").hide(); is also not working.

4

2 回答 2

1

尝试这个:

var iframe = $('<iframe frameborder="0" marginwidth="0" marginheight="0" allowfullscreen id="frameIdcustomer" onload="hideMenu()"></iframe>');

    function hideMenu(){
    $("#frameIdcustomer").contents().find("#menuheaderr").hide();
    }

要查找元素,您需要等到 iframe 内容加载完毕。

于 2013-06-26T13:21:18.053 回答
0

当您调用该行以隐藏标题时,iFrame 可能仍在加载。尝试将该行放在回调函数中。

var dialog = $("<div></div>").append(iframe).appendTo("body").dialog({
    autoOpen: false,
    ...
    complete: function() { $("#frameIdcustomer").contents().find("#menuheaderr").hide(); }
});
于 2013-06-26T12:57:21.123 回答