网络编程
位置:首页>> 网络编程>> JavaScript>> js调用flash代码

js调用flash代码

  发布时间:2010-01-23 12:35:00 

标签:flash,js,代码

JS代码:

function showFlash(src,w,h){
    html = '';
    html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="main">';
    html += '<param name="allowScriptAccess" value="sameDomain" />';
    html += '<param name="movie" value="images/'+src+'.swf" />';
    html += '<param name="quality" value="high" />';
    html += '<param name="menu" value="false" />';
    html += '<param name="wmode" value="transparent" />';
    html += '<embed src="images/'+src+'.swf"  wmode="transparent" menu="false" quality="high" width="'+w+'" height="'+h+'" name="main" align="center" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    html += '</object>';
    document.write(html);
}

以上代码保存为showFlash.js文件,在需要调用的页面<script language="javascript" src="images/showFlash.js"></script>

调用方法:

showFlash('文件名(不带扩展名)','宽度','高度')

例:

<script>showFlash('index','940','480')</script> 

 

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com