• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

js控制显示flash的加载进度条显示百分比代码

JavaScript 开心洋葱 2268次浏览 0个评论

js控制显示flash的加载进度条显示百分比代码

 

效果截图如下

js控制显示flash的加载进度条显示百分比代码

附带js加载显示flash代码,也可以显示广告或图片、flash等。。。

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js控制显示flash的加载进度条显示百分比代码</title>
</head>
<style>
*{padding:0px; margin:0px;}
body{text-align:center; background:#2f200a;}
</style>
<body>
<div id="flash_body" style="display:none;">
<object id='pageLodimgFlash' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="1024" height="768">
  <param name="movie" value="http://www.songhelin.cn//skins/default/indexflash/index.swf" />
  <param name="quality" value="high" />
  <embed src="http://www.songhelin.cn/skins/default/indexflash/index.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1024" height="768"></embed>
</object>
</div>
<div id="flash_img_loading" style="padding-top:250px; "><img src="loading.gif" /><br/></div>
<div id="flash_loading" style="padding-top:10px; color:#090; font-size:18px;"></div>
<script language="javascript" type="text/javascript">
/**
* 在IE中可用不着PercentLoaded()方法获取SWF的下载进度,在firefox中怎么获取?
*/
var ie = /*@cc_on!@*/false;
var movie = ie && window["game_flash4"] || document["welcome"];

//setInterval("document.title='Flash加载中,已经加载了'+ani_GetFlashState('loaded')+'/100';",100);
setInterval("flash_body_f(ani_GetFlashState('loaded'))",100);
function flash_body_f(loading_count){
	if(loading_count>=100){
		var obj = document.getElementById('flash_body');
		var obj_load = document.getElementById('flash_loading');
		var obj_load_img = document.getElementById('flash_img_loading');
		
		obj_load_img.style.display='none';
		obj.style.display = 'block';
		obj_load.innerHTML = '';
	}else{
		var obj 	 = document.getElementById('flash_body');
		var obj_load = document.getElementById('flash_loading');
		obj.style.display='none';
		obj_load.innerHTML = '网站加载中,已经加载了'+loading_count+'%...';
	}
	
}

function ani_GetFlashState(v)
{/* 获得当前FLASH的状态值[v=loaded(当前下载状态),v=current(当前播放针数),v=total(总播放针数)] */
if(ie)
{
if(v=='loaded')                        return document.getElementById('pageLodimgFlash').PercentLoaded();
else if(v=='current')        return document.getElementById('pageLodimgFlash').CurrentFrame();
else if(v=='total')                return document.getElementById('pageLodimgFlash').TotalFrames;
}
else
{
if(v=='loaded')                        return window.document.pageLodimgFlash.PercentLoaded()
else if(v=='current')        return window.document.pageLodimgFlash.CurrentFrame();
else if(v=='total')                return window.document.pageLodimgFlash.TotalFrames();
}
}
</script>
</body>
</html>

 


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明js控制显示flash的加载进度条显示百分比代码
喜欢 (0)

您必须 登录 才能发表评论!

加载中……