Advertisement
naimul64

Progressbar

May 13th, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Test</title>
  5.     <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
  6. </head>
  7. <body>
  8. <div class="progress progress-striped active">
  9.   <div class="bar" id="p_bar" style="width: 0%; color: red"></div>
  10. </div>
  11. <p id="numericProgress">0% Done</p>
  12. <script type="text/javascript">
  13.     var val = 0 ;
  14.  
  15.     setInterval(progress, 750)
  16.  
  17.     function progress(){
  18.         var p_bar = document.getElementById('p_bar');
  19.  
  20.         progress = Math.floor((Math.random() * 5) + 1);
  21.         val = val + progress;
  22.         if(val >= 100){
  23.             val = 0;
  24.         }
  25.        
  26.         p_bar.style.width = val + '%';
  27.  
  28.         var numericProgress = document.getElementById('numericProgress');
  29.         numericProgress.innerHTML = val + '% Done' ;
  30.  
  31.        
  32.     }
  33. </script>
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement