搜狐博客的Flash广告切换效果

//方法声明
//pics 图片地址串
//links 图片链接串
//adStatic 广告统计信息串
function showFocusImg(pics, links, adStatic) {
    var swf_width=295;
    var swf_height=220;

    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
    document.write('<param name="movie" value="/javascripts/slider_show/slider.swf"><param name="quality" value="high">');
    document.write('<param name="menu" value="false"><param name="wmode" value="opaque"><param name="allowScriptAccess" value="always">');
    document.write('<param name="FlashVars" value="bcastr_file='+pics+'&bcastr_link='+links+'&adStatic='+adStatic+'">');
    document.write('<embed src="/javascripts/slider_show/slider.swf" wmode="opaque" FlashVars="bcastr_file='+pics+'&bcastr_link='+links+'&adStatic='+adStatic+'&menu=false" quality="high" allowScriptAccess="always"  width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
}
var pics="";
var links="";
var adStatics="";

var len=dataAry.length;
for(var i=0;i<len;i++){
    var splits="|";
    if(i>=len-1){
        splits="";
    }
    pics+=dataAry[i]["pic"]+splits;
    links+=dataAry[i]["tlink"]+splits;
    adStatics+=dataAry[i]["adStatic"]+splits;
}

//方法调用生成焦点图flash
showFocusImg(pics, links, adStatics); 


调用方法:
  <script type="text/javascript">
  var dataAry = new Array();
  
  dataAry.push({
  pic : 'http://192.168.42.7:3000/uploads/spaces/covers/10362/small/space_cover.jpg?1239705639',
  tlink : 'http://www.baidu.com'});

dataAry.push({
  pic : 'http://i6.itc.cn/20090414/173_f8031e5c_3981_4d12_af18_7802cc07f545_0.jpg',
  tlink : 'http://www.baidu.com'});

dataAry.push({
  pic : '/images/a.jpg',
  tlink : 'http://www.baidu.com'});

  </script>
  <%=javascript_include_tag 'slider_show/play' %>

你可能感兴趣的:(JavaScript,html,Flash)