#region 首页切换的图片
public void SetPicChg()
{
//BLL.Articles Art = new BLL.Articles();
Maticsoft.BLL.UrlNav urnav = new Maticsoft.BLL.UrlNav();
String swher = " UpID =51";
DataTable dt = new DataTable();
dt = urnav.GetList(swher).Tables[0];
if (dt.Rows.Count > 0)
{
string strScript = "function showPicChg(){";
strScript += "var i=0;var pics = \"\";var links = \"\";var texts = \"\";var intJ = 0; ";
foreach (DataRow dr in dt.Rows)
{
if (dr["Pic"].ToString() != "" && dr["Pic"].ToString() != null)
{
// String isin = dr["isin"].ToString();
strScript = strScript + "intJ = intJ + 1; "
+ "if (intJ == 1){strInterval = \"\";}else{strInterval = \"|\";} ";
String url = dr["Pic"].ToString().Trim();
if (dr["url"].ToString().Length > 1)
{
strScript += "pics += strInterval + \"" + url + "\"; ";
}
else
{
strScript += "pics += strInterval + \"" + url + "\"; ";
}
if (dr["Name"].ToString().Length > 30)
{
strScript += "texts = texts + strInterval + \"" + dr["Name"].ToString().Substring(0, 16) + "\";";
}
else
{
strScript += "texts = texts + strInterval + \"" + dr["Name"].ToString() + "\";";
}
strScript += "links = links + strInterval + escape(\""+ dr["URL"].ToString() + "\");";
}
}
strScript += "var focus_width=411; var focus_height=221; var text_height=22; var swf_height = focus_height+text_height; ;"
+ "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/focus1.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#F0F0F0\">');"
+ "document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"transparent\"><param name=\"align\" value=\"Default\">'); "
+ "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/focus1.swf\" wmode=\"opaque\" align = \"Default\" flashvars=\"texts='+texts+'&pics='+pics+'&links='+links+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'\"menu=\"false\" bgcolor=\"#F0F0F0\" 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>');";
strScript += "}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PicChg", strScript, true);
}
//divimage.InnerHtml = strScript;
//}
}
#endregion
前台在 要放幻灯片的位置放上 <script> showPicChg() </script>