【发布时间】:2015-02-06 13:28:09
【问题描述】:
我正在用 ASP.NET 开发一个应用程序,旨在创建报表并将它们下载到客户端。我正在使用发布到服务器的 iframe 执行此操作。操作完成后,使用 Response.Write() 将报告下载到客户端。
与此同时,在客户端上,我正在显示一个 GIF 以表明服务器正在生成报告。当报告成功创建并完成写入客户端后,我想相应地更新 iframe,并隐藏 GIF。
有没有办法判断 response.write() 在 iframe 的父页面中是否成功?
家长:
<iframe id="iframe1" src="import-upload.html" width="100%" height="300" onload="loadFrame()" frameborder="0">
function redirect(type) {
iframe.getElementById('inputType').value = list.options[list.selectedIndex].value;
iframe.getElementById('inputAction').value = type;
document.getElementById("divOptionsContainer").style.display = "none";
document.getElementById("imgLoadingGif").style.display = "";
iframe.getElementById('frmUpload').submit();
}
iframe 来源:
<div align="center">
<form id="frmUpload" action="AjaxFileHandler.aspx" method="POST" enctype="multipart/form-data" target="_self" style="margin-bottom:20px;">
<input id="fileupload" type="file" name="files[]" />
<input type="hidden" id="inputAction" name="action"/>
<input type="hidden" id="inputType" name="type"/>
</form>
<button id="btnReport" type="button" onclick="parent.redirect('Report')" style="">Report</button>
<button id="btnUpload" type="button" onclick="parent.redirect('Import')" style="">Import</button>
</div>
这是我的第一篇文章。如果需要更多信息,请告诉我。提前致谢。
【问题讨论】:
标签: javascript asp.net iframe