The progress bar is when the computer is processing a task, it displays the speed of processing the task, the degree of completion, the size of the remaining unfinished tasks, and the possible processing time in the form of pictures in real time. It is usually displayed in a rectangular bar shape. This article mainly introduces the code that uses PHP code to achieve the progress bar effect
<html> <head> </head> <body> <table width="400" border="0" cellspacing="1" cellpadding="1"> <tr> <td bgcolor="000000"> <table width="400" border="0" cellspacing="0" cellpadding="1"> <tr> <td bgcolor="ffffff"> <img src="bar.gif" src="bar.gif" width="0" height="16" id="percent_img" name="percent_img" align="absmiddle"> </td> </tr> </table> </td> <td> <span id="percent_txt" name="percent_txt">0%</span> </td> </tr> </table> </body> </html> <?php flush(); for($i=0;$i<=100;$i++) //循环输出100次JavaScript代码 { $width = $i * 4; echo "<SCRIPT>"; echo "percent_img.width=$width;"; //控制图片宽度 echo "percent_txt.innerHTML='$i%';"; //控制百分比显示 echo "</SCRIPT>"; for($j=0;$j<1000000;$j++) { //为了演示进度条的效果,这里执行了一个空循环 } flush(); } ?>
The above is the detailed content of Progress bar implemented by php code. For more information, please follow other related articles on the PHP Chinese website!