Html页面中Flash的播放,并利用JS变换Flash

advertiser-Flash.js:

var w = 350;
var h = 400;

function swf(file) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,0,1,152" width="' + w + '" height="' + h + '"> ');
document.write('<param name="movie" value="' + file + '">');
document.write('<param name="quality" value="high"> ');
document.write('<param name="wmode" value="transparent"> ');
document.write('<param name="menu" value="false"> ');

document.write('<embed src="' + file + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed> ');
document.write('</object> ');
}

function NewComing(file) {
var htmlStr = null;
htmlStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,0,1,152"';
htmlStr += ' width="' + w + '" height="' + h + '"> ';
htmlStr += '<param name="movie" value="' + file + '">';
htmlStr += '<param name="quality" value="high">';
htmlStr += '<param name="wmode" value="transparent">';
htmlStr += '<param name="menu" value="false"> ';
htmlStr += '<embed src="' + file + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" ';
htmlStr += 'type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>';
htmlStr += '</object>';
return htmlStr;

}

function DefaultPlay(file) {
swf(file);
}

function KeyPlay(file) {
document.getElementById("content_flash").innerHTML = NewComing(file);
}

页面代码(加载页面时,默认开始播放第一个):

<script type="text/javascript" src="advertiser-flash.js"></script>


<div style="width:40%" id="content_flash">
<script type="text/javascript" language="javascript">DefaultPlay("flash/1.swf");</script>
</div> 
<div style="width:60%">

<ul class="left_nav1" style="margin-top:10px;">
<li class="left_nav1_li left_nav1_li_default " onclick="KeyPlay('flash/1.swf');">
</li>
<li class="left_nav1_li" onclick="KeyPlay('flash/2.swf');">

</li>
<li class="left_nav1_li" onclick="KeyPlay('flash/3.swf');">

</li>
<li class="left_nav1_li" onclick="KeyPlay('flash/4.swf');">

</li>
<li class="left_nav1_li" onclick="KeyPlay('flash/5.swf');">

</li>
</ul>
</div>

 
就这样吧。其实关键还是那个JS~~~




posted @ 2011-11-27 13:29  One Ivan  阅读(2612)  评论(0编辑  收藏  举报