【发布时间】:2014-05-03 16:45:45
【问题描述】:
我对为什么我构建的模式对话框没有加载锚标记中的“href”属性指定的页面感到头疼。
Javascript:
// let's build an info dialog!
$( '.infolink' ).each(function() {
var $page = $(this);
var url = $page.attr('href');
var $docviewer = $('<div class="stuffHolder"></div>')
.dialog({
open: function() {
$( '.stuffHolder' ).load(url);
},
title: "Additional Information",
position: { my: "center top", at: "center top", of: "#trbl" },
show: true, //animates a fade in for the window
autoOpen: false, //dialogs do not open by default
width: 600, //sets dialog width
height: 600, //sets dialog height
modal: true, //disables everything below the dialog until dialog is closed
buttons: {
"Close Document": function() {
$(this).dialog("close");
}
}
});
$page.click(function() {
$docviewer.dialog('open');
return false;
});
}); // end info dialog
HTML:
<a href="test.html" class="infolink">Load test page into modal dialog</a>
对话框加载正常,但加载时完全为空。
【问题讨论】:
-
你确定你的test.html的路径是正确的吗?
-
@entiendoNull - 是的,html 文件的路径是正确的。该文件与调用它的页面位于同一文件夹中。
标签: javascript jquery jquery-ui