首页 文章

在Internet Explorer 8中更改jQuery对话框 Headers

提问于
浏览
0

我有以下代码 load a dynamic page inside a jQuery dialog and place the contents of the <title> element of that page in the title bar of the dialog . 它适用于Internet Explorer 9-11版本(最新版本的Mozilla Firefox,谷歌Chrome和Opera,尚未尝试过早期版本),但是 in IE 8 the title bar is empty . 任何补救措施?

UPDATE:http://jsfiddle.net/5WfcY/看小提琴

<script>
$(".opencategory").click(function(e) {
    e.preventDefault();
    $("#category").load("category.php", {
        categoryid: $(this).data("categoryid")
    }, function() {
        $("#category").dialog("option", "title", $(this).find("title").text());
        $("#category").dialog("open");
    });
});

$("#category").dialog({
    autoOpen: false,
    modal: true
});
</script>

<ul>
    <li><a href="#" data-categoryid="1" class="opencategory">Category 1</a></li>
    <li><a href="#" data-categoryid="2" class="opencategory">Category 2</a></li>
    <li><a href="#" data-categoryid="3" class="opencategory">Category 3</a></li>
    <li><a href="#" data-categoryid="4" class="opencategory">Category 4</a></li>
    <li><a href="#" data-categoryid="5" class="opencategory">Category 5</a></li>
</ul>

<div id="category"></div>

1 回答

  • 0

    好吧,我可以确认将 Headers 保存为AJAX调用页面中隐藏输入字段的值 .

    所以在category.php中我把:

    <input type="hidden" id="title" value="Dynamic title" />
    

    在jQuery中,我用以下方法获取:

    $("#category").dialog("option", "title", $("#title").val());
    

相关问题