js点击按钮出现进程条

来源:互联网 发布:游戏机掌机需要网络吗? 编辑:程序博客网 时间:2024/06/15 05:28

js点击按钮出现进程条

转自:http://wangjinlongaisong-126-com.iteye.com/blog/939687

<html> <head> <title>  </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body,html{margin:0;padding:20px;font-size:12px;font-family:Arial;font:12px/1 Tahoma, Arial;} .stepOut{height:20px;border:1px solid #000;background:#eee;width:200px;overflow:hidden;display:none;} .stepIn{width:50px;background:#FF0080;border-top:1px solid #FFB5DA;border-bottom:1px solid #fff;overflow:hidden;color:#fff;text-align:center;font:12px/1.6 arial;} </style><script type="text/javascript" src="http://52mfx.com/tools/alert.js"></script> </head> <body> <button id="google">button</button><br/><br/> <div class="stepOut" id="stepOut" >     <div class="stepIn" id="stepIn"></div> </div> </body> <script type="text/javascript"> function LoadBar(outer,iner,time){     $=function (x){return typeof x=="string"?document.getElementById(x):x};     outer=$(outer);     iner=$(iner);     var i,width,This=this,s=(time||2000)/10;     this.run=function (){         clearTimeout(This.t);         outer.style.display='block';         width=outer.offsetWidth;         i=0;         (function (){             iner.style.width=width/s*i++;             iner.innerHTML=Math.ceil(iner.offsetWidth/width*100)+'%';             if(i<s){This.t=setTimeout(arguments.callee,10)                 }else{iner.innerHTML="ok"}         })()               } }; var ldh=new LoadBar(stepOut,stepIn,5000); document.getElementById('google').onclick=ldh.run; </script> </html> 

效果:


0 0
原创粉丝点击