用Javascript向Flash传递参数

Posted on 2006-10-14 09:43 太清剑客 阅读(2692) 评论(1)  编辑  收藏 所属分类: Script

就是SINA那个最近很流行的图片导航
代码如下:

 1 < script language = " javascript "  type = " text/javascript " >
 2 // <!--
 3 var  focus_width = 168;      //flash宽度
 4 var  focus_height = 126;      //flash高度
 5 var  text_height = 18;      //说明字符高度
 6 var  swf_height  =  focus_height + text_height;
 7 var  pics =' 1.jpg | 2.jpg | 3.jpg | 4.jpg' ;     //图片位置,都用|隔开,如果没有就是'|||'
 8 var  links = ' 1. html |/2. html |/3. html|4 .html';   //图片链接地址
 9 var  texts = '图片1 | 图片2 | 图片3 |图片4 ';     //图片说明
10     document.write(' < object ID = " focus_flash "  classid = " clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 "  codebase = " http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 "  width = " '+ focus_width +' "  height = " '+ swf_height +' " > ');
11     document.write(' < param name = " allowScriptAccess "  value = " sameDomain " >< param name = " movie "  value = " images/ImgShow.swf " >< param name = " quality "  value = " high " >< param name = " bgcolor "  value = " #FFFFFF " > ');
12     document.write(' < param name = " menu "  value = " false " >< param name = wmode value = " opaque " > ');
13     document.write(' < param name = " FlashVars "  value = " pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+' " > ');
14     document.write(' < embed ID = " focus_flash "  src = " images/ImgShow.swf "  wmode = " opaque "  FlashVars = " pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+' "  menu = " false "  bgcolor = " #C5C5C5 "  quality = " high "  width = " '+ focus_width +' "  height = " '+ swf_height +' "  allowScriptAccess = " sameDomain "  type = " application/x-shockwave-flash "  pluginspage = " http://www.macromedia.com/go/getflashplayer "   /> ');document.write(' </ object > ');
15 //替换里面的2个images/ImgShow.swf为你的flash位置 -->
16 </ script >
ImgShow.swf:此处点击下载

Feedback

# re: 用Javascript向Flash传递参数  回复  更多评论   

2008-11-14 11:01 by 侍郎
...根本不能用!!!

只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问  
 

posts - 10, comments - 4, trackbacks - 0, articles - 0

Copyright © 太清剑客