JS绘制进度条

来源:互联网 发布:linux 重新编译php 编辑:程序博客网 时间:2024/05/21 07:13
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title> New Document </title><meta name="Generator" content="EditPlus"><meta name="Author" content=""><meta name="Keywords" content=""><meta name="Description" content=""></head><body> <script>  var progress = 0;  var colors = new Array("#FFFF00","#FFCC99","#CCFF33","#FF3300","#6600FF","#66FF33","#0000CC","#990033","#CC3300");  window.onload = function(){      drawProgress();     }  function drawProgress() {   progress += 10;   var width = document.getElementById('progressbar').style.width;   width = parseInt(width.substring(0,width.indexOf('px')));   width += progress;   document.getElementById('progressbar').style.width = width +"px";   window.status = '加载进度' + progress + "%";   document.all('progr').innerHTML = "<font color=blue size=2>加载进度:"+progress+"%</font>";   var i = Math.round(Math.random()*10);   if (i >= 10)   {    i = 9;   }   document.all('progressbar').style.backgroundColor = colors[i];   if (progress < 100)   {    i = setTimeout('drawProgress()',500);   }   else {    clearTimeout(i);    window.location.href='http://www.baidu.com';   }  } </script> <span id='progr'></span> <div id='progressbar' style='width:10px;height:18px;background-color:#00FFFF'></div></body></html>


 

原创粉丝点击