WEB页面简单进度记时器

 1<html>
 2<head>
 3<title> TimeBar Version 1.0 </title>
 4<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 5<meta content="20;url=" http-equiv="Refresh"/>
 6<style>   
 7td {font-size: 10.5pt; color: 147e19; font-family: Courier New;}   
 8</style>
 9</head>
10<body bgcolor="#FFFFFF">
11<br/><br/><br/><br/>
12<center>
13<table border="0" width="500">
14<tr><td>
15<br/>
16<p align="center">TimeBar V1.0 by [email protected]<br/>请查看源代码<br/>   
17请设置进度条的增长速度和每次增长的长度</p>
18<table align="left"><tr><td bgcolor="#99ccff" height="5" id="Ratio" width="1"></td></tr></table>
19<!--将上面一行的align=left换成right或center,看看效果如何-->
20</td></tr>
21<tr><td bgcolor="eeeeee"> 20秒后刷新本页</td></tr>
22</table></center>
23</body>
24</html>
 1<script language="javascript">   
 2//TimeBar V1.0 by [email protected]   
 3//2000.11   
 4  
 5ShowRatio();   
 6function ShowRatio()   
 7{   
 8var intTimer=40; //进度条增长速度   
 9var intAddwidth=1; //每次增长的长度,最小为1   
10var intMaxWidth=500; //最大宽度   
11//以上两个数值需要根据你的进度条总宽和延迟时间决定,例如: 本页的进度条长度为500,需要在20秒后刷新或离开本页,则   
12//intAddwidth=(20*1000)/500=40.当然,可以让intAddwidth=80,intTimer=2,请试一试。   
13var rw;   
14if (Ratio.width=="") Ratio.width=1;   
15rw=parseInt(Ratio.width);   
16Ratio.width=rw+intAddwidth;   
17if (rw+10<intMaxWidth) setTimeout("ShowRatio()",intTimer);   
18}   
19</script>

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】

Published At
Categories with Web编程
comments powered by Disqus