最近遇到一个问题,关于flash通过flashVars参数传值!

贴出源代码:

<script type="text/javascript">
imgUrl1="img/1.jpg";
imgtext1=""
imgLink1=escape("");
imgUrl2="img/2.jpg";
imgtext2=""
imgLink2=escape("");
imgUrl3="img/3.jpg";
imgtext3=""
imgLink3=escape("");



 var focus_width=1002
 var focus_height=291
 var text_height=15
 var swf_height = focus_height+text_height
 
 var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3
 var links=imgLink1+"|"+imgLink2+"|"+imgLink3
 var texts=imgtext1+"|"+imgtext2+"|"+imgtext3
 
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ focus_width +'" height="'+ swf_height +'">');
 document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="路径.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
 document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
 document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
 document.write('</object>');
</script>

这段代码只能在ie下显示正常,但是在其他浏览器下却不能显示,在网上找了好半天才找到解决方案!

解决方案:在<object></object>间,加上这句代码

document.write('<embed src="路径.swf" quality="high" width="1002" height="291" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"/>');

就可以解决了!