0

IE9でIframeが機能しないJqueryダイアログ。

parent.aspxにHTMLボタンがあります

<input type="button" id="btnMessageFilter" class="mainFont" value="Message Filter"/>

「btnMessageFilter」クリックで、Jqueryダイアログで別のaspxページ(child.aspx)を開きたい。私はこのようにこれをしていました:

$(document).ready(function () {
    $("#btnMessageFilter").live('click', function () {
        var iframe = $("<iframe>").attr({
            "src": "MessageFilter.aspx?btn=btnRefresh",
            "height": "100%",
            "marginwidth": "0",
            "marginheight": "0",
            "scrolling": "auto",
            "frameborder": "0"
        });
        $("#dialog2").empty().append(iframe);
        $("#dialog2").dialog({
            modal: true,
            title: 'Message Filter',
            width: 400,
            height: 450
        });
        $("#dialog2").parent().appendTo('form');
        return false;
    });
});      

コードはIE9を除いて正常に動作しました。上記のタラを修正するための提案、またはJqueryダイアログで別のaspxを開く別の方法はありますか?

4

2 に答える 2

3

あなたのコードの何が問題なのかわかりません。しかし、私は私のウェブサイトのいくつかのページで iframes + jQuery-ui ダイアログを次のように使用しています:

var iframe = $('<iframe frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>');
var dialog = $("<div></div>").append(iframe).appendTo("body").dialog({
    autoOpen: false, // autoopen is set to false (we'll create only one dialog and open it on-demand)
    modal: true,
    resizable: false,
    width: "auto",  // set width and
    height: "auto", // height to auto (we'll set width/height on the content)
    close: function() {
        iframe.attr("src", ""); // load blank document in iframe
                                // can be useful in situations, for example,
                                // when your frame is playing audio or video
    }
});
$('#btnMessageFilter').click(function() {
    iframe.attr("width", 400).attr("height", 200); // set width/height on the content
    dialog.dialog("option", "title", "Message Filter").dialog("open");
    iframe.attr("src", "http://example.com");
});

デモはこちら

于 2012-05-09T08:42:08.197 に答える
0

この問題の適切な解決策がまだ見つからないため、このスレッドに返信しています。

この問題を解決するには、「操作の最後に iframe src」を設定していることを確認してください。

例 - 上記の場合、src は .dialog() 呼び出しの後に設定する必要があります。

于 2012-05-17T11:18:23.210 に答える