ASP进度条 |
|
作者:佚名 文章来源:网络文摘 更新时间:2006-5-6 13:22:07 |
【声明:转载此信息在于传递更多信息,其内容表达的观点并不代表本站立场,由这些信息所产生的一切后果本站不负任何责任。如果您对本信息有什么意见,欢迎和本站联系,谢谢!】http://CiDu.Net
前段时间研究了一个进度条,大致的思想是 在后台处理数据时,前台页面同时计数显示Proess Bar 使用了layer来显示 用法: 1。引用 <script language="javascript" src="ShowProcessBar.js"></script> 2。在提交Button或<A>或<span> 加扩展属性 IsShowProcessBar="True"
文件ShowProcessBar.js如下
AddProcessbar(); var bwidth=0; var swidth = document.all.waiting.clientWidth;
function CheckIsProcessBar(obj) { if (obj.IsShowProcessBar=="True") { return false; } else { return true; } }
function CheckClick(e) { if (e == 1) { if (bwidth<swidth*0.98){ bwidth += (swidth - bwidth) * 0.025; if (document.all)document.sbar.width = bwidth; else document.rating.clip.width = bwidth; setTimeout('CheckClick(1);',150);
} } else { if(document.all) { if(document.all.waiting.style.visibility == 'visible') {document.all.waiting.style.visibility = 'hidden'; bwidth = 1;} whichIt = event.srcElement;
while (CheckIsProcessBar(whichIt)) { whichIt = whichIt.parentElement; if (whichIt == null)return true; }
document.all.waiting.style.pixelTop = (document.body.offsetHeight - document.all.waiting.clientHeight) / 2 + document.body.scrollTop; document.all.waiting.style.pixelLeft = (document.body.offsetWidth - document.all.waiting.clientWidth) / 2 + document.body.scrollLeft; document.all.waiting.style.visibility = 'visible'; if(!bwidth)CheckClick(1); bwidth = 1;
}
else {
if(document.waiting.visibility == 'show') {document.waiting.visibility = 'hide'; document.rating.visibility = 'hide'; bwidth = 1;} if(e.target.href.toString() != '') { document.waiting.top = (window.innerHeight - document.waiting.clip.height) / 2 + self.pageYOffset; document.waiting.left = (window.innerWidth - document.waiting.clip.width) / 2 + self.pageXOffset; document.waiting.visibility = 'show'; document.rating.top = (window.innerHeight - document.waiting.clip.height) / 2 + self.pageYOffset+document.waiting.clip.height-10; document.rating.left = (window.innerWidth - document.waiting.clip.width) / 2 + self.pageXOffset; document.rating.visibility = 'show'; if(!bwidth)CheckClick(1); bwidth = 1; } } return true; } }
function AddProcessbar() {
var Str="" Str+= "<div id=waiting style=position:absolute;top:50px;left:100px;z-index:1;visibility:hidden >"; Str+= "<layer name=waiting visibility=visible zIndex=2 >" Str+= "<table border=2 cellspacing=1 cellpadding=0 bordercolorlight=#FFFFFF bordercolordark=#C0C0C0 bgcolor=#E0E0E0>" Str+= " <tr>" Str+= " <td bgcolor=#E0E0E0 height=30px width=300px align=center>" Str+= " <font color=black>系統正在處理中...</font>" Str+= " </td>" Str+= " </tr>" Str+= " <tr>" Str+= " <td bgcolor=#E0E0E0>" Str+= " <img width=1 height=10 name=sbar style=background-color:#6699cc>" Str+= " </td>" Str+= " </tr>" Str+= "</table> " Str+= "</layer>" Str+= "</div>" document.write(Str)
if(document.all)document.onclick = CheckClick; }
测试文件TestShowBar.HTML
<HTML> <HEAD> <script language="javascript" src="ShowProcessBar.js"></script> </HEAD> <BODY> <A href="error.asp" IsShowProcessBar="True">A Href</a> <BR> <BR> <span onclick="location.href='error.asp'" style="cursor:hand" IsShowProcessBar="True"><font color=blue>Span</font></span> <BR> <form action="error.asp"> <input type=Submit value="Submit"> <input type=button value="normal button" IsShowProcessBar="True"> </form> <P IsShowProcessBar="True">AAAAAAAAAAAAA</P> </BODY> </HTML>
声明:以上信息资料大都是网上搜集而来,版权归作者,如有版权问题请留言告知我将马上改正。 文中所提到的各种观点只是原文观点,各种说法未经一一确认。并不代表本站认可此观点!!
|
资讯录入:admin 责任编辑:admin |
|
上一篇资讯: 将人民币的数字表示转化成大写表示
下一篇资讯: 在ASP处理程序时显示进度 |
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |