<div><span class="intro">下载进度:</span>
  <div class="barborder">
    <div class="bar" id="loadpercent"></div>
  </div>
</div> 
定义广告层:
<div id="showAD"></div> 
  定义FLASH显示层:
<div id="showSWF" class="show" style="display:none;"> 
  <object id="flashgame" ......省略内容......>
  </object>
</div> 
文章来自学IT网:http://www.xueit.com/html/2010-01-04/33-1619445279781.html
<script language="javascript"> 

   if(window.navigator.userAgent.indexOf("Firefox")>=1)//判断是否为FIREFOX浏览器,FIREFOX不支持PercentLoaded()函数
   { 
      document.getElementById("loadpercent").innerHTML= "Firefox!No Attentions"; 
      document.getElementById("showSWF").style.display='block'; 
   } 
   else
   { 
      refreshProgress(); 
   }

     function show()//隐藏AD层、显示FLASH层 
     { 
       document.getElementById("showAD").style.display='none'; 
       document.getElementById("showSWF").style.display='block'; 
     } 
     
     function refreshProgress()//刷新进度条函数 
     { 
       var downProgressWidth=502; 
       var bar = document.getElementById("loadpercent"); 
       var movie = document.getElementById("flashgame"); 
       var nPercentLoaded = Math.abs(movie.PercentLoaded()); 
       bar.style.width=Math.ceil(downProgressWidth*nPercentLoaded/100) +"px"; 
       bar.innerHTML= nPercentLoaded +"%"; 
       
       if(nPercentLoaded==100) 
       { 
         bar.style.width=(downProgressWidth-2) + "px"; bar.innerHTML= "Game download is complete"; show(); 
       } 
       else 
       { 
         setTimeout('refreshProgress()',0); 
       } 
}
 
 
posted on 2010-04-12 14:21  信封牛  阅读(2906)  评论(0编辑  收藏  举报