- UID
- 799481
|
ASP进度条
用法:
1。引用
< language="java" src="/ShowProcessBar.js"></>
2。在提交Button或<A>或<span> 加扩展属性
IsShowProcessBar="True"
文件ShowProcessBar.js如下
AddProcessbar();
var bwidth=0;
var swidth = all.waiting.clientWidth;
CheckIsProcessBar(obj)
{
if (obj.IsShowProcessBar=="True")
{
return false;
}
else
{
return true;
}
}
CheckClick(e)
{
if (e == 1)
{
if (bwidth<swidth*0.98){
bwidth += (swidth - bwidth) * 0.025;
if (all)sbar.width = bwidth;
else rating.clip.width = bwidth;
setTimeout('CheckClick(1);',150);
}
}
else
{
if(all)
{
if(all.waiting.style.visibility == 'visible')
{all.waiting.style.visibility = 'hidden';
bwidth = 1;}
whichIt = event.srcElement;
while (CheckIsProcessBar(whichIt))
{
whichIt = whichIt.parentElement;
if (whichIt == null)return true;
}
all.waiting.style.pixelTop = (body.offsetHeight - all.waiting.clientHeight) / 2 + body.scrollTop;
all.waiting.style.pixelLeft = (body.offsetWidth - all.waiting.clientWidth) / 2 + body.scrollLeft;
all.waiting.style.visibility = 'visible';
if(!bwidth)CheckClick(1);
bwidth = 1;
}
else
{
if(waiting.visibility == 'show')
{waiting.visibility = 'hide';
rating.visibility = 'hide';
bwidth = 1;}
if(e.target.href.toString() != '')
{
waiting.top = (innerHeight - waiting.clip.height) / 2 + self.pageYOffset;
waiting.left = (innerWidth - waiting.clip.width) / 2 + self.pageXOffset;
waiting.visibility = 'show';
rating.top = (innerHeight - waiting.clip.height) / 2 + self.pageYOffset+waiting.clip.height-10;
rating.left = (innerWidth - waiting.clip.width) / 2 + self.pageXOffset;
rating.visibility = 'show';
if(!bwidth)CheckClick(1);
bwidth = 1;
}
}
return true;
}
}
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>"
write(Str)
if(all) = CheckClick;
}
测试文件TestShowBar.HTML
<HTML>
<HEAD>
< language="java" src="/ShowProcessBar.js"></>
</HEAD>
<BODY>
<A href="/error.asp" IsShowProcessBar="True">A Href</a>
<BR>
<BR>
<span ="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> |
|