现在的位置: 首页 > 综合 > 正文

翻滚图片代码

2013年07月07日 ⁄ 综合 ⁄ 共 2641字 ⁄ 字号 评论关闭

前台代码--这是五张图片

 

<a href="javascript:goUrl()" target="_self"><span class="f14b">

    <script type="text/javascript">
imgUrl1="<%=hotpic[0]%>";
imgtext1="";
imgLink1=escape("<%=hotlink[0]%>");
imgUrl2="<%=hotpic[1]%>";
imgtext2="";
imgLink2=escape("<%=hotlink[1]%>");
imgUrl3="<%=hotpic[2]%>";
imgtext3="";
imgLink3=escape("<%=hotlink[2]%>");
imgUrl4="<%=hotpic[3]%>";
imgtext4="";
imgLink4=escape("<%=hotlink[3]%>");
imgUrl5="<%=hotpic[4]%>";
imgtext5="";
imgLink5=escape("<%=hotlink[4]%>");
var focus_width=340
var focus_height=270
var text_height=0
var swf_height = focus_height+text_height

var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5
var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5
var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5
  
    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="'+ focus_width +'" height="'+ swf_height +'">');
          document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#>');
          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('<embed src="images/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
    </script>

</span></a>

 

后台代码

 

 #region"定义变量和控件"

    public string[] hotpic = new string[5];
    public string[] hotlink = new string[5];

    #endregion

    #region"Page_Load"

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {//从数据库读出五条图片数据
            DataSet dstAdo = BLL.Tra_HotImg.GetListByTopN(" Order by add_time DESC ","5");

            if (dstAdo.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dstAdo.Tables[0].Rows.Count; i++)
                {
                    hotpic[i] =  dstAdo.Tables[0].Rows[i]["upload_img"].ToString();
                    hotlink[i] = dstAdo.Tables[0].Rows[i]["img_url"].ToString();
                }
            }
        }
        catch (Exception ex)
        {
          throw(ex);
        }
    }

 

最后要下载 pixviewer.swf图片播放器

抱歉!评论已关闭.