JS實例之進度條制作,實現進度條讀條效果
阿新 • • 發佈:2017-06-22
back class meta border top set inpu adding 效果
1 <head> 2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 3 <title>無標題文檔</title> 4 <style type="text/css"> 5 *{margin:0px auto; padding:0px;} 6 #wai{width:200px; height:20px; margin-top:100px; border:1px solid #666;} 7 #nei{width:0%; height:20px; background-color:#F00; float:left;} 8 </style> 9 </head> 10 11 <body> 12 <div id="wai"> 13 <div id="nei"></div> 14 </div> 15 <input type="button" value="開始" onclick="zou()"/> 16 </body> 17 <script type="text/javascript"> 18 var a=0; 19 functionzou(){ 20 if(a<100){ 21 a++; 22 } 23 document.getElementById("nei").style.width =a+"%"; 24 window.setTimeout("zou()",5); 25 } 26 </script> 27 </html>
JS實例之進度條制作,實現進度條讀條效果