当前位置:首页 > 网页页面中如何用Javascript调用Flash动画?

网页页面中如何用Javascript调用Flash动画?

点击次数:1307  更新日期:2011-01-04
\n

问:网页页面中如何用Javascript调用Flash动画?


\n

答:


\n

在<HEADE>区加入


\n

程序代码


\n

<script src=”js/flash.js” type=”text/javascript”></script>


\n

在调用FLASH处加入


\n

程序代码


\n

<script language=”JavaScript” type=”text/javascript”>
<!–
playswf(“swf/名字.swf”,宽,高)
//–>
</script>


\n

flash.js代码:


\n

程序代码


\n

// JavaScript Document
function playswf(sFile,sWidth,sHeight){
document.write(‘<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”‘+ sWidth +’” height=”‘+ sHeight +’”> ‘);
document.write(‘ <param name=”movie” value=”‘+ sFile +’”> ‘);
document.write(‘ <param name=”quality” value=”high”> ‘);
document.write(‘ <param name=”wmode” value=”transparent”> ‘);
document.write(‘ <embed src=”‘+ sFile +’” wmode=”transparent” quality=”high” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash” width=”‘+ sWidth +’” height=”‘+ sHeight +’”></embed> ‘);
document.write(‘</object> ‘);
}


\n