javascript的高级使用,设置页面元素是否相应事件与显示“正在处理”对话框
2007-03-31 22:16
1011 查看
var oProgressLayer=null;
/************************************************************************************************
// 设置网页上所有元素为不可响应事件,以及设置鼠标光标为wait
*************************************************************************************************/
function SetBusy(){
for(var iCnt=0;iCnt<document.all.length;iCnt++){
try{document.all[iCnt].oldCursor=document.all[iCnt].style.cursor;
document.all[iCnt].style.cursor='wait';}catch(e){;}
try{document.all[iCnt].oldonmousedown=document.all[iCnt].onmousedown;
document.all[iCnt].onmousedown=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonclick=document.all[iCnt].onclick;
document.all[iCnt].onclick=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonmouseover=document.all[iCnt].onmouseover;
document.all[iCnt].onmouseover=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonmousemove=document.all[iCnt].onmousemove;
document.all[iCnt].onmousemove=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonkeydown=document.all[iCnt].onkeydown;
document.all[iCnt].onkeydown=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldoncontextmenu=document.all[iCnt].oncontextmenu;
document.all[iCnt].oncontextmenu=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonselectstart=document.all[iCnt].onselectstart;
document.all[iCnt].onselectstart=function(){return false;}}catch(e){;}
}
}
/************************************************************************************************
// 恢复网页上所有元素可以响应事件,以及设置鼠标光标默认光标
*************************************************************************************************/
function ReleaseBusy(){
for(var iCnt=0;iCnt<document.all.length;iCnt++){
try{document.all[iCnt].style.cursor=document.all[iCnt].oldCursor;}catch(e){;}
try{document.all[iCnt].onmousedown=document.all[iCnt].oldonmousedown;}catch(e){;}
try{document.all[iCnt].onclick=document.all[iCnt].oldonclick;}catch(e){;}
try{document.all[iCnt].onmouseover=document.all[iCnt].oldonmouseover;}catch(e){;}
try{document.all[iCnt].onmousemove=document.all[iCnt].oldonmousemove;}catch(e){;}
try{document.all[iCnt].onkeydown=document.all[iCnt].oldonkeydown;}catch(e){;}
try{document.all[iCnt].oncontextmenu=document.all[iCnt].oldoncontextmenu;}catch(e){;}
try{document.all[iCnt].onselectstart=document.all[iCnt].oldonselectstart;}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" />'+
' 正在处理数据,请稍候……'+
'</td>'+
'</tr>'+
'</table>';
document.body.appendChild(oProgressLayer);
//SetBusy();
}
/************************************************************************************************
// 显示“正在处理”对话框 (样式二) 进度条样式
*************************************************************************************************/
function ShowProgressInfo1( message ){
if(oProgressLayer) return;
//SetBusy();
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">'+ message +
'<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>'+
'</marquee>'+
'</span>'+
'</span>';
document.body.appendChild(oProgressLayer);
//SetBusy();
document.write( oProgressLayer.outerHTML );
}
/************************************************************************************************
// 设置网页上所有元素为不可响应事件,以及设置鼠标光标为wait
*************************************************************************************************/
function SetBusy(){
for(var iCnt=0;iCnt<document.all.length;iCnt++){
try{document.all[iCnt].oldCursor=document.all[iCnt].style.cursor;
document.all[iCnt].style.cursor='wait';}catch(e){;}
try{document.all[iCnt].oldonmousedown=document.all[iCnt].onmousedown;
document.all[iCnt].onmousedown=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonclick=document.all[iCnt].onclick;
document.all[iCnt].onclick=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonmouseover=document.all[iCnt].onmouseover;
document.all[iCnt].onmouseover=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonmousemove=document.all[iCnt].onmousemove;
document.all[iCnt].onmousemove=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonkeydown=document.all[iCnt].onkeydown;
document.all[iCnt].onkeydown=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldoncontextmenu=document.all[iCnt].oncontextmenu;
document.all[iCnt].oncontextmenu=function(){return false;}}catch(e){;}
try{document.all[iCnt].oldonselectstart=document.all[iCnt].onselectstart;
document.all[iCnt].onselectstart=function(){return false;}}catch(e){;}
}
}
/************************************************************************************************
// 恢复网页上所有元素可以响应事件,以及设置鼠标光标默认光标
*************************************************************************************************/
function ReleaseBusy(){
for(var iCnt=0;iCnt<document.all.length;iCnt++){
try{document.all[iCnt].style.cursor=document.all[iCnt].oldCursor;}catch(e){;}
try{document.all[iCnt].onmousedown=document.all[iCnt].oldonmousedown;}catch(e){;}
try{document.all[iCnt].onclick=document.all[iCnt].oldonclick;}catch(e){;}
try{document.all[iCnt].onmouseover=document.all[iCnt].oldonmouseover;}catch(e){;}
try{document.all[iCnt].onmousemove=document.all[iCnt].oldonmousemove;}catch(e){;}
try{document.all[iCnt].onkeydown=document.all[iCnt].oldonkeydown;}catch(e){;}
try{document.all[iCnt].oncontextmenu=document.all[iCnt].oldoncontextmenu;}catch(e){;}
try{document.all[iCnt].onselectstart=document.all[iCnt].oldonselectstart;}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" />'+
' 正在处理数据,请稍候……'+
'</td>'+
'</tr>'+
'</table>';
document.body.appendChild(oProgressLayer);
//SetBusy();
}
/************************************************************************************************
// 显示“正在处理”对话框 (样式二) 进度条样式
*************************************************************************************************/
function ShowProgressInfo1( message ){
if(oProgressLayer) return;
//SetBusy();
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">'+ message +
'<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>'+
'</marquee>'+
'</span>'+
'</span>';
document.body.appendChild(oProgressLayer);
//SetBusy();
document.write( oProgressLayer.outerHTML );
}
相关文章推荐
- 使用jQuery制作高级炫酷吊炸天表单,页面加载完成文本框获得焦点,文本框设置默认文本,文本字数动态显示.....
- 使用webview加载本地html页面,并处理html页面中的javascript事件
- 在 .NET 中设置页面元素的 javascript 事件 - IEBrowser [5]
- JavaScript之jQuery-4 jQuery事件(页面加载后执行、事件处理、事件冒泡、事件对象、模拟操作)
- 使用可变参数批量设置view显示,隐藏,点击事件
- 一个WinForm记事本程序(包含主/下拉/弹出菜单/打开文件/保存文件/打印/页面设置/字体/颜色对话框/剪切版操作等等控件用法以及记事本菜单事件/按键事件的具体代码)
- 使用Javascript控制某个Div是否显示
- Net处理html页面元素工具类(HtmlAgilityPack.dll)的使用
- Net处理html页面元素工具类(HtmlAgilityPack.dll)的使用
- Javascript 给页面元素添加事件函数探讨
- javascript中如何判断一个元素在页面中是否存在(转)
- C# 使用printDocument1.Print打印时不显示 正在打印对话框(里面还有一个讨厌的取消按钮)
- 使用AmplifyJS和JQuery编写更好更优雅的javascript事件处理代码
- 在ASP.NET页面中推荐使用覆写(Override)而不是事件处理(Event Handler)
- 在ASP.NET页面中推荐使用覆写(Override)而不是事件处理(Event Handler)
- jQuery使用之(四)处理页面的表单元素
- JSP获得当前页面名称后判断是否显示页面元素的方法
- 使用HTML5里页面可见性接口判断用户是否正在观看你的页面
- JavaScript移除绑定在元素上的匿名事件处理函数
- JavaScript网站设计实践(四)编写about.html页面,利用JavaScript和DOM,选择性的显示和隐藏DIV元素