js 简单的进度条
html部分
<div id='div1'>
<div id="div2"></div>
</div>
css部分
div{
height:10px ;
border-radius:5px;
}
#div1{
width:600px ;
background: #333;
}
js部分
<script type="text/javascript">
window.onload=function(){
var oDiv1=document.getElementById('div1');
var oDiv2=document.getElementById('div2');
var timer=null;
var num=+1;
timer =setInterval(function(){
if(num <= 100){
oDiv2.style.width=num+'%';
oDiv2.style.background='#2375E1';
num++
}else{
clearInterval(timer);
}
},1000)
}
</script>