现在的位置: 首页 > 综合 > 正文

PHP执行程序进度条demo .

2012年03月16日 ⁄ 综合 ⁄ 共 12711字 ⁄ 字号 评论关闭
<?php  
  1. session_start();  
  2. $zs=21;//设置任务总数
      
  3. if(!isset($_SESSION['num']))  
  4. $_SESSION['num']=$zs;//赋予session变量值
      
  5. $jd=$_SESSION['num']--;//进度值
      
  6. echo $jd;//显示进度值
      
  7. echo "<br />";  
  8. echo 100-round($jd/$zs*100)."%";//显示完成进度百分比
      
  9. ?>  

以下是图形化的demo

  1. <?php  
  2. session_start();  
  3. $zs=121;//设置任务总数
      
  4. if(!isset($_SESSION['num']))  
  5. $_SESSION['num']=$zs;//赋予session变量值
      
  6. $jd=$_SESSION['num']--;//进度值
      
  7. echo $jd;//显示进度值
      
  8. echo "<br />";  
  9. echo 100-round($jd/$zs*100)."%";//显示完成进度百分比
      
  10. ?>  
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  12. <html xmlns="http://www.w3.org/1999/xhtml">  
  13. <head>  
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  15. <title>进度条demo</title>  
  16. <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>  
  17. <script language="javascript" type="text/javascript">  
  18.         //        //判断窗体是否最大化   
  19.         //        if (window.screen) {//判断浏览器是否支持window.screen判断浏览器是否支持screen    
      
  20.         //            var myw = screen.availWidth;   //定义一个myw,接受到当前全屏的宽    
      
  21.         //            var myh = screen.availHeight;  //定义一个myw,接受到当前全屏的高    
      
  22.         //            window.moveTo(0, 0);           //把window放在左上脚    
      
  23.         //            window.resizeTo(myw, myh);     //把当前窗体的长宽跳转为myw和myh    
      
  24.         //        }   
  25.         //弹出隐藏层   
  26.         function ShowDiv(show_div, bg_div) {  
  27.             document.getElementById(show_div).style.display = 'block';  
  28.             document.getElementById(bg_div).style.display = 'block';  
  29.             var bgdiv = document.getElementById(bg_div);  
  30.             bgdiv.style.width = document.body.scrollWidth;  
  31.             $("#" + bg_div).height($(document).height());  
  32.         };  
  33.         //关闭弹出层   
  34.         function CloseDiv(show_div, bg_div) {  
  35.             document.getElementById(show_div).style.display = 'none';  
  36.             document.getElementById(bg_div).style.display = 'none';  
  37.             $("#country").val($("#name").val());  
  38.         };  
  39.         //窗口大小改变时   
  40.         $(window).resize(function() {  
  41.             if (!$('#MyDiv').is(':hidden')) popup();  
  42.         });  
  43.   
  44.         //重新设置遮罩层的高和宽   
  45.         function popup() {  
  46.             var maskHeight = $(document).height();  
  47.             var maskWidth = $(window).width();  
  48.             $('#fade').css({ height: maskHeight, width: maskWidth }).show();  
  49.         }  
  50. </script>  
  51. <style type="text/css">  
  52. .black_overlay { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.5; opacity: 0.5; filter: alpha(opacity=50); -khtml-opacity: 0.5; }  
  53. .white_content { display: none; position: absolute; top: 45%; left: 40%; width: 17.8%; height: 6%; z-index: 1002; overflow: visible;  color: #FFF; }  
  54. <!--  
  55. .white_content_small { display: none; position: fixed; top: 20%; left: 30%; width: 40%; height: 50%; border: 16px solid lightblue; background-color: white; z-index: 1002; overflow: auto; }  
  56. -->  
  57. #jdt { height:13px; display:block; text-align:center; font-size:9px; color:#333; background-image: url(loadings.gif); width:<?php echo 100-round($jd/$zs*100)."%";?>; }  
  58. #jdtbj { background-color: #ACACAC; height: 13px; width: 208px; }  
  59. #MyDiv .text { text-align: center; }  
  60. </style>  
  61. </head>  
  62.   
  63. <body onload="ShowDiv('MyDiv','fade');">  
  64. <div id="fade" class="black_overlay"></div>  
  65. <div id="MyDiv" class="white_content">  
  66. <div class="text">正在载入中......</div>  
  67.   <div id="jdtbj">  
  68.     <div id="jdt"><?php echo 100-round($jd/$zs*100)."%";?></div>  
  69.   </div>  
  70. </div>  
  71. </body>  
  72. </html>  
  1. session_start();  
  2. $zs=21;//设置任务总数
      
  3. if(!isset($_SESSION['num']))  
  4. $_SESSION['num']=$zs;//赋予session变量值
      
  5. $jd=$_SESSION['num']--;//进度值
      
  6. echo $jd;//显示进度值
      
  7. echo "<br />";  
  8. echo 100-round($jd/$zs*100)."%";//显示完成进度百分比
      
  9. ?>  

以下是图形化的demo

  1. <?php  
  2. session_start();  
  3. $zs=121;//设置任务总数
      
  4. if(!isset($_SESSION['num']))  
  5. $_SESSION['num']=$zs;//赋予session变量值
      
  6. $jd=$_SESSION['num']--;//进度值
      
  7. echo $jd;//显示进度值
      
  8. echo "<br />";  
  9. echo 100-round($jd/$zs*100)."%";//显示完成进度百分比
      
  10. ?>  
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  12. <html xmlns="http://www.w3.org/1999/xhtml">  
  13. <head>  
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  15. <title>进度条demo</title>  
  16. <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>  
  17. <script language="javascript" type="text/javascript">  
  18.         //        //判断窗体是否最大化   
  19.         //        if (window.screen) {//判断浏览器是否支持window.screen判断浏览器是否支持screen    
      
  20.         //            var myw = screen.availWidth;   //定义一个myw,接受到当前全屏的宽    
      
  21.         //            var myh = screen.availHeight;  //定义一个myw,接受到当前全屏的高    
      
  22.         //            window.moveTo(0, 0);           //把window放在左上脚    
      
  23.         //            window.resizeTo(myw, myh);     //把当前窗体的长宽跳转为myw和myh    
      
  24.         //        }   
  25.         //弹出隐藏层   
  26.         function ShowDiv(show_div, bg_div) {  
  27.             document.getElementById(show_div).style.display = 'block';  
  28.             document.getElementById(bg_div).style.display = 'block';  
  29.             var bgdiv = document.getElementById(bg_div);  
  30.             bgdiv.style.width = document.body.scrollWidth;  
  31.             $("#" + bg_div).height($(document).height());  
  32.         };  
  33.         //关闭弹出层   
  34.         function CloseDiv(show_div, bg_div) {  
  35.             document.getElementById(show_div).style.display = 'none';  
  36.             document.getElementById(bg_div).style.display = 'none';  
  37.             $("#country").val($("#name").val());  
  38.         };  
  39.         //窗口大小改变时   
  40.         $(window).resize(function() {  
  41.             if (!$('#MyDiv').is(':hidden')) popup();  
  42.         });  
  43.   
  44.         //重新设置遮罩层的高和宽   
  45.         function popup() {  
  46.             var maskHeight = $(document).height();  
  47.             var maskWidth = $(window).width();  
  48.             $('#fade').css({ height: maskHeight, width: maskWidth }).show();  
  49.         }  
  50. </script>  
  51. <style type="text/css">  
  52. .black_overlay { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.5; opacity: 0.5; filter: alpha(opacity=50); -khtml-opacity: 0.5; }  
  53. .white_content { display: none; position: absolute; top: 45%; left: 40%; width: 17.8%; height: 6%; z-index: 1002; overflow: visible;  color: #FFF; }  
  54. <!--  
  55. .white_content_small { display: none; position: fixed; top: 20%; left: 30%; width: 40%; height: 50%; border: 16px solid lightblue; background-color: white; z-index: 1002; overflow: auto; }  
  56. -->  
  57. #jdt { height:13px; display:block; text-align:center; font-size:9px; color:#333; background-image: url(loadings.gif); width:<?php echo 100-round($jd/$zs*100)."%";?>; }  
  58. #jdtbj { background-color: #ACACAC; height: 13px; width: 208px; }  
  59. #MyDiv .text { text-align: center; }  
  60. </style>  
  61. </head>  
  62.   
  63. <body onload="ShowDiv('MyDiv','fade');">  
  64. <div id="fade" class="black_overlay"></div>  
  65. <div id="MyDiv" class="white_content">  
  66. <div class="text">正在载入中......</div>  
  67.   <div id="jdtbj">  
  68.     <div id="jdt"><?php echo 100-round($jd/$zs*100)."%";?></div>  
  69.   </div>  
  70. </div>  
  71. </body>  
  72. </html>  
【上篇】
【下篇】

抱歉!评论已关闭.