日期:2014-05-18 浏览次数:20466 次
//首页幻灯片 public string Getpic() { //这里根据你自己的需要来修改一下 //实例化实体类 NewsContent newscontent = new NewsContent(); string pic = ""; newscontent.Menuid = 11; newscontent.Top = 5; DataTable dt = new DataTable(); try { dt = bll_newscontent.SearchTable(newscontent); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } //这个是把图片地址放到字符串里面 string str = "uploadfile/" + dt.Rows[0][3].ToString() + "|" + "uploadfile/" + dt.Rows[1][3].ToString() + "|" + "uploadfile/" + dt.Rows[2][3].ToString() + "|" + "uploadfile/" + dt.Rows[3][3].ToString() + "|" + "uploadfile/" + dt.Rows[4][3].ToString(); //这里是拼的js代码, pic = "<script type=text/javascript>" + "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=370 height=238 >');" + "document.write('<param name=allowScriptAccess value=sameDomain><param name=movie value=images/focus1.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=" + str + "&borderwidth=370&borderheight=238 >');" + "document.write('</object>');" + "</script>"; return pic; }
------解决方案--------------------
http://ad.jz123.cn/ 共享收藏的一个网给大家
------解决方案--------------------
其实你把轮换的东西放在<asp:Repeater>然后绑定路径和ID一样能实现 在模板里面可以写JS例如下面这样
<asp:Repeater runat="server" ID="dlPhoto"> <HeaderTemplate> <%#"<script type=\"text/javascript\">"%> var focus_width=236 var focus_height=210 var text_height=20 var swf_height = focus_height+text_height var pics='' var links='' var texts='' </HeaderTemplate> <ItemTemplate> pics +='<%#(Container.ItemIndex ==0 )?"":"|"%><%#Eval("filepath")%>' links +='<%#(Container.ItemIndex ==0 )?"":"|"%>' texts +='<%#(Container.ItemIndex ==0 )?"":"|"%><%#Eval("title")%>' </ItemTemplate> <FooterTemplate> var