js进度条

1.第一个:栅状进度条

<html>
<head>
<title>进度条—qifei</title>
</head>
<body>
<form name=loading>
  <p align=center>
    <input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#ffffff; background-color:#0099ff; padding:0px; border-style:none;">
    <br>
    <input type=text name=percent size=47 style="color:#0099ff; text-align:center; border-width:medium; border-style:none;">
  </p>
</form>
</body>
</html>
<script>
var bar=0
var line="||"
var amount="||"
count()
function count()
{
bar=bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.percent.value=bar+"%"
if (bar<99)
   {setTimeout("count()",50);}
else
   {window.location = "index.html";}
}
</script>
2.第二个==颜色块进度条

<html>  
<head>  
<title>进度条—qifei</title>  
<style>  
<!--  
#bar,   #barbackground{  
position:absolute;  
left:0;  
top:0;  
background-color:blue;  
}  
#barbackground{  
background-color:black;  
}  
-->  
</style>  
<script language="JavaScript">  
var   duration=5  
function postaction(){}  
var   clipright=0  
var   widthIE=0  
var   widthNS=0  
function initializebar()
{  
    if (document.all)
    {  
    baranchor.style.visibility="visible"  
    widthIE=bar.style.pixelWidth  
    startIE=setInterval("increaseIE()",50)  
    }  
    if (document.layers)
    {  
    widthNS=document.baranchorNS.document.barbackgroundNS.clip.width  
    document.baranchorNS.document.barNS.clip.right=0  
    document.baranchorNS.visibility="show"  
    startNS=setInterval("increaseNS()",50)  
    }  
}
 
function increaseIE()
{  
bar.style.clip="rect(0   "+clipright+"   auto   0)"  
window.status="Loading..."  
if (clipright<widthIE)  
    clipright=clipright+(widthIE/(duration*20))  
else
    {  
    window.status=''  
    clearInterval(startIE)  
    postaction()  
    }  
}
 
function increaseNS()
{  
if (clipright<202)
    {  
    window.status="Loading..."  
    document.baranchorNS.document.barNS.clip.right=clipright  
    clipright=clipright+(widthNS/(duration*20))  
    }  
else
    {  
    window.status=''  
    clearInterval(startNS)  
    postaction()  
    }  

window.οnlοad=initializebar  
</script>  
</head>  
<body bgcolor="#FFFFFF">  
<script language="JavaScript">  
if (document.all)
{  
document.write('<div   id="baranchor"   style="position:relative;width:200px;height:20px;visibility:hidden;">')  
document.write('<div   id="barbackground"   style="width:200px;height:20px;z-index:9"></div>')  
document.write('<div   id="bar"   style="width:200px;height:20px;z-index:10"></div>')  
document.write('</div>')  
}  
</script>
<ilayer name="baranchorNS" visibility="hide" width=200 height=20>  
    <layer name="barbackgroundNS" bgcolor=black width=200 height=20 z-index=10 left=0 top=0></layer>  
    <layer name="barNS" bgcolor=blue width=200 height=20 z-index=11 left=0 top=0></layer>  
</ilayer>  
</body>  
</html>

3.第三个==渐变色进度条

<html>
<head>
<title>渐变效果进度条</title>
<script language="javascript">
 var i;
 function go()
 {
  bar_width = document.getElementById("bg").clientWidth;
  i = bar_width;
  setTimeout('start();',300);
 }
 function start()
 {
  if(i-->0)
  {
   ps.style.width = i;
   bn.innerHTML = Math.floor((bar_width-i)/bar_width*100)+"%";
   setTimeout('start();',20);
  }
 }
 
</script>
<style type="text/css">
#bg {
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr=#FFFF00, EndColorStr=#FF0000);
width:300px;
height:20px;
border:1px solid black;
z-index:0;
position:absolute;
}
#ps {
float:right;
background-color:#FFFF00;
width:100%;
}
#bn {
position:absolute;
text-align:center;
width:100%;
height:100%;
cursor:default;
}
</style>
</head>
<body οnlοad="go();">
<div id="bg"><div id="ps"></div><span id="bn">0%</span></div>
</body>
</html>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值