//--> //loading //獲取瀏覽器的高度與寬度
var _PageHeight = document.documentElement.clientHeight,
_PageWidth = document.documentElement.clientWidth;
//判斷loading距左和上
var _LoadingTop = _PageHeight > 61 ? (_PageHeight - 61) / 2 : 0,
_LoadingLeft = _PageWidth > 215 ? (_PageWidth - 215) / 2 : 0;
//載入條,可以任意更換圖片及膜的樣式
var _LoadingHtml = '<div id="loadingDiv" style="position:absolute;left:0;width:100%;height:' + _PageHeight + 'px;top:0;background:#E0ECFF;opacity:0.8;filter:alpha(opacity=80);z-index:10000;"><div style="position: absolute; cursor1: wait; left: ' + _LoadingLeft + 'px; top:' + _LoadingTop + 'px; width: 84px; height: 84px; line-height: 100px; padding-left: 50px; padding-right: 5px; background: url(/waiting.gif) no-repeat scroll 5px 10px; "></div></div>';
//生成這個樣式
document.write(_LoadingHtml);
//window.onload = function () {
// var loadingMask = document.getElementById('loadingDiv');
// loadingMask.parentNode.removeChild(loadingMask);
//};
//如果頁面載入
document.onreadystatechange = completeLoading;
//判斷資料是否載入完成
var loadingMask="";
function completeLoading() {
if (document.readyState == "complete") {
loadingMask = document.getElementById('loadingDiv');
showtimes();
}
}
function showtimes() {
loadingMask.parentNode.removeChild(loadingMask);
}
要使用此方法,只需要將其放在1個js控制元件中,頁面呼叫此js即可,支援火狐與IE,but Ifram會獲取不到高度與寬度