C# 后台执行脚本

 写在C# cs 界面

 页面图片切换效果 http://www.lanrentuku.com/js/jiaodiantu-927.html

 1  StringBuilder sb = new StringBuilder();
 2         sb.Append("<script type=\"text/javascript\">");
 3         sb.Append("    linkarr = new Array();");
 4         sb.Append("    picarr = new Array();");
 5         sb.Append("    textarr = new Array();");
 6         sb.Append("    var swf_width = 980;");
 7         sb.Append("    var swf_height = 340;");
 8         sb.Append("    var configtg = '0xffffff|96|0x3FA61F|5|0xffffff|0xC5DDBC|0x000033|2|3|1|_blank';");
 9         sb.Append("    var files = \"\";");
10         sb.Append("    var links =\"\";");
11         sb.Append("    var texts = \"\";   ");
12     
13         strSql = "select * from picinfo where classid=8";
14         DataSet ds = sm.Get_Table(strSql, ref strErr);
15         if (ds.Tables[0].Rows.Count > 0)
16         {
17             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
18             {
19                 string id = (i + 1).ToString();
20                 string url = " linkarr[" + id + "] =\"\" ;";
21 
22                 string pic = "  picarr[" + id + "] =" + "\"syimg/" + ds.Tables[i].Rows[i]["pic_url"].ToString() + "\"; ";
23                 string text = "   textarr[" + id + "] = \"\";";
24 
25                 sb.Append(url);
26                 sb.Append(pic);
27                 sb.Append(text);
28             }
29         }
30         sb.Append("       for (i = 1; i < picarr.length; i++) {");
31         sb.Append("          if (files == \"\") files = picarr[i];");
32         sb.Append("          else files += \"|\" + picarr[i];  ");
33         sb.Append("      }");
34         sb.Append("      for (i = 1; i < linkarr.length; i++) { ");
35         sb.Append("           if (links ==\"\") links = linkarr[i]; ");
36         sb.Append("           else links += \"|\" + linkarr[i]; ");
37         sb.Append("      } ");
38         sb.Append("      for (i = 1; i < textarr.length; i++) { ");
39         sb.Append("         if (texts == \"\") texts = textarr[i];  ");
40         sb.Append("         else texts += \"|\" + textarr[i];  ");
41         sb.Append("      }  ");
42         sb.Append("      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 + '\">');       ");
43         sb.Append("      document.write('<param name=\"movie\" value=\"images/bcastr3.swf\"><param name=\"quality\" value=\"high\">');   ");
44         sb.Append("      document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">');    ");
45         sb.Append("      document.write('<param name=\"FlashVars\" value=\"bcastr_file=' + files + '&bcastr_link=' + links + '&bcastr_title=' + texts + '\">');  ");
46         sb.Append("      document.write('<embed src=\"images/bcastr3.swf\" wmode=\"opaque\" FlashVars=\"bcastr_file=' + files + '&bcastr_link=' + links + '&bcastr_title=' + texts + '& menu=\"false\" quality=\"high\" width=\"' + swf_width + '\" height=\"' + swf_height + '\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'); document.write('</object>');    ");
47         sb.Append("</script>");
48         msclass_script = sb.ToString();

posted @ 2013-03-26 17:49  yellowshorts  阅读(748)  评论(0编辑  收藏  举报