Wednesday, 12 July 2017

Javascript progress bar

Display status of a determinate or indeterminate process. 
You can use it for show processing levels.

<!-- Progress bar holder -->  
 <div id="progress" style="width:500px;border:1px solid #ccc;"></div>  
 <!-- Progress information -->  
 <div id="information" style="width"></div>  
 <?php  
 $total = 10000;  // Total processes  
 for ($i = 1; $i <= $total; $i++) {  
   $percent = intval($i / $total * 100);  // Calculate the percentation  
   ?>  
   <script>  
     document.getElementById("progress").innerHTML ="<div style='width: <?php echo $percent; ?>%; background-color:#ddd;'>&nbsp;</div>";  
     document.getElementById("information").innerHTML ="<?php echo $i; ?> row(s) processed.";  
   </script>  
   <?php  
   flush();        // Send output to browser immediately  
 }  
 ?>  

No comments:

Post a Comment

How to create an visitor counter in PHP | hit counter

Total page view in the php. This count hit in the page. <?php session_start(); if(isset($_SESSION['page_view'])){...