【发布时间】:2010-05-31 14:58:47
【问题描述】:
在我的 Web 应用程序中,我称文档可能很大。该文档被加载到 iframe 中。
我有一个标题、按钮和文本,它们都依赖于这个文档。文本来自大文档并显示在 iframe 中。我想在文档加载到 3 个位置(1:文档标题,2:文档按钮,3:文档文本,iframe)时显示动画 gif
我在 iframe 上尝试了 onload 事件,但这并没有给我想要的效果。
这是我加载文档的代码:
function loadDocument(id, doc) {
$("#DocumentContent").show();
$("#ButtonBox").show();
// Clear dynamic menu items
$("#DynamicMenuContent").html("");
$("#PageContent").html("");
// Load document in frame
$("#iframeDocument").attr("src", 'ViewDoc.aspx?id=' + id + '&doc=' + doc + '');
// $("#iframeDocument").attr("src", "Graphics/loader.gif");
// Load menu items
$.ajax({
url: "ShowButtons.aspx?id=" + id + "&doc=" + doc,
success: function(data) { $("#DynamicMenuContent").html(data) },
error: function(xhr, err, e) { alert("error: " + err) }
});
// Set document title
$("#documentTitle").load("GetDocumentInfo.aspx?p=title");
}
我的问题,如何在加载文档时显示加载器 gif?并在文档准备好时删除 gif?
【问题讨论】: