• javascript获取Flash下载进度兼容IE, FireFox,Chrome浏览器


     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2  <html xmlns="http://www.w3.org/1999/xhtml">
     3  <head>
     4  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
     5  <title>flash load progress</title>
     6  <script>
     7  </script>
     8  </head>
     9  <body>
    10  <div><span class="intro">下载进度:</span>
    11    <div class="barborder">
    12      <div class="bar" id="loadpercent"></div>
    13    </div>
    14  </div>
    15  
    16 
    17 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="700px" height="350" id="ieGame">
    18      <param name="movie" value="http://360.kuaiwan.com/games/6/6C36DF75DE92FF1148592FF0F093E5C00DA17A91.swf">
    19      <param name="quality" value="high"><param name="wmode" value="transparent">
    20      <embed 
    21          wmode="transparent" 
    22          src="http://360.kuaiwan.com/games/6/6C36DF75DE92FF1148592FF0F093E5C00DA17A91.swf" 
    23          quality="high" 
    24          type="application/x-shockwave-flash" 
    25          pluginspage="http://www.macromedia.com/go/getflashplayer" 
    26          width="700px" height="350px" id="fireFoxGame" name="fireFoxGame">
    27      </embed>
    28  </object>
    29  </body>
    30  </html>
    31  
    32 
    33 <script>
    34   
    35   if(window.navigator.userAgent.indexOf("Firefox")>=1 || window.navigator.userAgent.indexOf("AppleWebKit")>=1) {/*is fireFox*/
    36   var progress = self.setInterval(function() { 
    37   var progress = document.fireFoxGame;
    38   document.getElementById("loadpercent").innerHTML=""+progress.PercentLoaded();
    39   }, 5);
    40   //document.getElementById("loadpercent").innerHTML=""+Math.abs(progress)+"%";
    41   } else { /*is IE*/
    42   refreshProgress();
    43   }
    44   function show(){//隐藏AD层、显示FLASH层
    45  document.getElementById("showAD").style.display='none';
    46   //document.getElementById("showSWF").style.display='block';
    47   }
    48   
    49   function refreshProgress() { //刷新进度条函数
    50  var bar = document.getElementById("loadpercent");
    51   var movie = document.getElementById("ieGame");
    52   var nPercentLoaded = Math.abs(movie.PercentLoaded());
    53   bar.innerHTML= nPercentLoaded+"%";
    54   if(nPercentLoaded==100) {
    55   bar.innerHTML= "Game download is complete";
    56   } else {
    57   setTimeout('refreshProgress()',0);
    58   }
    59   }
    60  </script>
  • 相关阅读:
    CentOS 安装 Xamarin官方Mono
    mongo命令行下去除重复的数据
    通过前端js将页面表格导出为PDF(二)
    通过前端js将页面表格导出为PDF(一)
    ubuntu下手动安装MongoDB
    在django项目下执行定时任务
    django+uwsgi+nginx部署在ubuntu系统上
    Nginx(三)
    Nginx(二)
    Nginx(一)
  • 原文地址:https://www.cnblogs.com/lyghost/p/2799015.html
Copyright © 2020-2023  润新知