Busy状态并显示提示信息

// 功能:设置应用程序Busy状态并显示提示信息
// 作者:圪圪
// QQ:433649
// MSN:gegeTerminator@hotmail.com
// 日期:2004年10月20日 22:46:57

<script>
var oProgressLayer=null;
function SetBusy(){
var myObj=document.all.tags("input");
for(var i=0;i<myObj.length;i++){
try{myObj[i].disabled=true;}catch(e){;}
}
var myObj=document.all.tags("a");
for(var i=0;i<myObj.length;i++){
try{
myObj[i].disabled=true;
myObj[i].oldοnclick=myObj[i].onclick;
myObj[i].οnclick=function(){return false;};}catch(e){;}
}

var myObj=document.all;
for(var i=0;i<myObj.length;i++){
try{myObj[i].disabled=true;}catch(e){;}
}
}
/************************************************************************************************
// 恢复网页上所有元素可以响应事件,以及设置鼠标光标默认光标
*************************************************************************************************/
function ReleaseBusy(){
var myObj=document.all.tags("input");
for(var i=0;i<myObj.length;i++){
try{myObj[i].disabled=false;}catch(e){;}
}
var myObj=document.all.tags("a");
for(var i=0;i<myObj.length;i++){
try{
myObj[i].disabled=false;
myObj[i].οnclick=myObj[i].oldonclick;
}
catch(e){;}
}

var myObj=document.all;
for(var i=0;i<myObj.length;i++){
try{myObj[i].disabled=false;}catch(e){;}
}
}
/************************************************************************************************
// 关闭“正在处理"对话框
*************************************************************************************************/
function HideProgressInfo(){
if(oProgressLayer){
ReleaseBusy();
oProgressLayer.removeNode(true);
oProgressLayer=null;
}
}
/************************************************************************************************
// 显示“正在处理”对话框 (样式一) 动画光标样式
*************************************************************************************************/
function ShowProgressInfo(){
if(oProgressLayer) return;
oProgressLayer=document.createElement('DIV');
with(oProgressLayer.style){
width='230px';
height='70px';
position='absolute';
left=(document.body.clientWidth-230)>>1;
top=(document.body.clientHeight-70)>>1;
backgroundColor='buttonFace';
borderLeft='solid 1px silver';
borderTop='solid 1px silver';
borderRight='solid 1px gray';
borderBottom='solid 1px gray';
fontWeight='700';
fontSize='13px';
zIndex='999';
}
oProgressLayer.innerHTML=
'<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">'+
'<tr>'+
'<td align="center" valign="middle">'+
'<img src="/Images/Processing.gif" border="0" align="absmiddle" />'+
'&nbsp;&nbsp;正在处理数据,请稍候……'+
'</td>'+
'</tr>'+
'</table>';
document.body.appendChild(oProgressLayer);
//SetBusy();
}

/************************************************************************************************
// 显示“正在处理”对话框 (样式二) 进度条样式
*************************************************************************************************/
function ShowProgressInfo1(){
if(oProgressLayer) return;
oProgressLayer=document.createElement('DIV');
with(oProgressLayer.style){
width='230px';
height='70px';
position='absolute';
left=(document.body.clientWidth-230)>>1;
top=(document.body.clientHeight-70)>>1;
backgroundColor='buttonFace';
borderLeft='solid 1px silver';
borderTop='solid 1px silver';
borderRight='solid 1px gray';
borderBottom='solid 1px gray';
fontWeight='700';
fontSize='13px';
zIndex='999';
}
oProgressLayer.innerHTML='<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td align="center" valign="middle">'+
'正在处理数据,请稍候……<br />'+
'<span style="border:solid 1px black;padding:1px;height:14px;margin-top:5px;">'+
'<span style="width:150px;height:12px;border:none;padding:-1px;overflow:hidden;">'+
'<marquee style="width:150px;" direction="right" scrollamount="10">'+
'<span style="padding:1px;text-align:right;width:130px;height:10px;background-color:#0000A0;filter:Alpha(startX=0,startY=0, finishX=130, finishY=0,style=1,opacity=0,finishOpacity=100);">'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'<span style="width:12px;height:12px;margin-right:1px;border:solid 1px #0000E0;"><img src="about:blank" width="1" height="1" border="0" /></span>'+
'</span>'+
'</marquee>'+
'</span>'+
'</span>';
document.body.appendChild(oProgressLayer);
SetBusy();
}

</script>

<script language="JavaScript">
<!--
function __HideProgressInfo(){
window.setTimeout('HideProgressInfo();',10000); //设置为显示10秒后自动关闭
}
-->
</script>
<button οnclick="ShowProgressInfo1();__HideProgressInfo();">显示</button> <!-- 显示 -->
<a οnclick="alert(1)" ondoub>test</a>
abc

 

 

====================

缺点是无法跟踪服务器的真正的状态,这样很不好,

需用Ajax每隔多久时间获取是否已处理的完毕的状态,

然后在客户端做出反映。

====================

在前台要让客户端的数据端的数据不反映通常有几种作法

1, Iframe+div, 方在数据的上面,但难做到透明

2.disable,让网页的数据disable即可

3,我觉得以上二种都不好,应该有一种更好的方法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值