比较简单的一个符合web标准的JS调用flash方法
人气:1
微软XP升级出现的bug,就是对于使用传统网页制作模式插入页面的flash无法正常浏览,页面打开的时候flash周围是一个虚线框,需要点击一下才能正常浏览,以下的办法就是解决这一缺点,并且让flash能符合WEB标准,此外最重要的是,整个网站的所有flash都可以调用这一段代码,让你的代码更加简洁!
1.先建立一个flash.js的JS文件,并写入
function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http:/https://img.qb5200.com/download-x/download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
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="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}
2.在网页里<head>与</head>之间写入调用JS的代码:
<script type="text/javascript" language="javascript" src="flash.js"></script>
3.然后在网页主体内容里写入调用flash的代码(只要是flash都可以调用):
<script language="javascript" type="text/javascript">flash('images/01.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/02.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/03.swf','529','600');</script>
1.先建立一个flash.js的JS文件,并写入
复制代码 代码如下:
function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http:/https://img.qb5200.com/download-x/download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
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="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}
2.在网页里<head>与</head>之间写入调用JS的代码:
复制代码 代码如下:
<script type="text/javascript" language="javascript" src="flash.js"></script>
3.然后在网页主体内容里写入调用flash的代码(只要是flash都可以调用):
复制代码 代码如下:
<script language="javascript" type="text/javascript">flash('images/01.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/02.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/03.swf','529','600');</script>
加载全部内容