|
本文采用Javascript实现了将几个不同的flv 文件随机不重复播放,代码中的Flv地址自己换一下吧! <script type="text/javascript"> function rnd() { rnd.seed = (rnd.seed*9301+49297) % 233280; return rnd.seed/(233280.0); }; function rand(number) { return Math.ceil(rnd()*number); }; rnd.today=new Date(); rnd.seed=rnd.today.getTime(); var len = 6; var num = 0; var arrayAd = new Array(len); arrayAd[0] = "http://***.***.**.**/huangye/indexvideo/gygg01.flv"; arrayAd[1] = "http://***.***.**.**/huangye/indexvideo/gygg02.flv"; arrayAd[2] = "http://***.***.**.**/huangye/indexvideo/gygg03.flv"; arrayAd[3] = "http://***.***.**.**/huangye/indexvideo/gygg04.flv"; arrayAd[4] = "http://***.***.**.**/huangye/indexvideo/gygg05.flv"; arrayAd[5] = "http://***.***.**.**/huangye/indexvideo/dx1.flv"; arrayAd[6] = "http://***.***.**.**/huangye/indexvideo/dx2.flv"; var files=""; for(i = 0; i < len; i++) { num = rand(len - i); files+=arrayAd[num-1]+"|"; arrayAd.splice(num-1,1); } files+="http://***.***.**.**/huangye/indexvideo/gygg06.flv" var swf_width=332 var swf_height=170 var texts='公益广告1|公益广告2|公益广告3|公益广告4|公益广告5|公益广告6|公益广告7|公益广告8' var config='1:自动播放|1:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|60:主体透明度|0x66ff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:logo文字|:logo地址|:结束swf地址'
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">'); document.write('<param name="movie" value="http://www.ruochi.com/product/vcastr2/vcastr2.swf"><param name="quality" value="high">'); document.write('<param name="menu" value="false">'); document.write('<param name="allowFullScreen" value="true" />'); document.write('<param name="FlashVars" value="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'">'); document.write('<embed src="http://www.ruochi.com/product/vcastr2/vcastr2.swf" allowFullScreen="true" FlashVars="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'&LogoText=www.bb.cq.cn" menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');
</script>
|