62,074
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript" src="../JS/CustomReport/ReportView.js" />
<script type="text/javascript">
var canCloseWindow;
function $(o) { return document.getElementById(o); }
window.onresize = resizeDivHtmlReport;
function resizeDivHtmlReport() {
$("divHtmlReport").style.height = self.document.body.clientHeight - 55;
}
function GetStatus() {
canCloseWindow = document.getElementById("<%=txtCanCloseWindow.ClientID %>").value;
}
function CanCloseWindow(canCloseWindow) {
if (!canCloseWindow) {
window.event.returnValue = "报表正在生成中, 离开当前页面将影响页面的正常浏览.";
}
}
</script>
ReportView.js代码如下:
/*********************************/
var waiting_win;
function OpenWaiting() {
waiting_win = window.open('../waiting.aspx', 'WaitingWin', 'left='
+ (screen.availWidth - 300) / 2 + ',top='
+ (screen.availHeight - 200) / 2 + ',width=300,height=200');
}
function window_OnUnLoad() {
alert(waiting_win);
if (typeof (waiting_win) != "undefined" && waiting_win != null) {
try {
waiting_win.opener = null;
waiting_win.close();
}
catch (ex) { }
}
}
/*********************************/
<body onload="GetStatus()" onbeforeunload="CanCloseWindow()" onunload="window_OnUnLoad()">
//界面上还存放着一个html服务器控件用来保存canCloseWindow状态。
<input type="hidden" id="txtCanCloseWindow" value="true" runat="server" />
</body>