zoukankan      html  css  js  c++  java
  • 动态绑定Flash的图片和标题

    public void showFlash()
        {
            IList<NewsArticle> articleList = article.ListNewsArticleByRows("22",500);

            int count = 0;
            string pics = "";
            string links = "";
            string texts = "";
           
            for (int i = 0; i < articleList.Count; i++)
            {
                NewsArticle articleNew = (NewsArticle)articleList[i];
                if (articleNew.Content == "")
                {
                    continue;
                }
                string content = ((NewsArticle)articleList[i]).Content;
                int firstIndex = content.LastIndexOf("src=");
                if (firstIndex < 0)
                {
                    continue;
                }
                else
                {
                    int lastIndex = content.LastIndexOf("jpg")+3;
                    string fileName = content.Substring(firstIndex+5,lastIndex-(firstIndex+5));
                     //fileName = "images/a1.jpg|images/a2.jpg|images/a3.jpg|images/a4.jpg|images/a5.jpg";
                    pics += fileName;
                    links += "PhySituationDetails.aspx?id="+articleNew.ArticleID;
                    if (articleNew.Title.Length > 25)
                    {
                        texts += articleNew.Title.Substring(0, 25) + "...";
                    }
                    else
                    {
                        texts += articleNew.Title;
                    }
                    count++;
                    if (count != 5)
                    {
                        pics += "|";
                        links += "|";
                        texts += "|";
                    }
                }
                if (count == 5)
                {
                    break;
                }
            }
            string innerHtml = "<script type='text/javascript'>";
            innerHtml += "var focus_width=400;\n";
            innerHtml += "var focus_height=300;\n";
            innerHtml += "var text_height=25;\n";
            innerHtml += "var swf_height = focus_height + text_height;\n";
           // innerHtml += "var pics='" + pics + "';\n";
            innerHtml += "var pics='"+pics+"';\n";
            innerHtml += "var links='" + links + "';\n";
            innerHtml += "var texts='" + texts + "';\n";
            innerHtml += "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 +'\">');";
            innerHtml += "document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"focus1.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#F0F0F0\">');";
            innerHtml += "document.write('<param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"opaque\">');";
            innerHtml += "document.write('<param name=\"FlashVars\" align=\"left\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'\">');";
            innerHtml += "document.write('</object>');";
            innerHtml += "</script>";
            this.flashTD.InnerHtml= innerHtml;
                  
        }

  • 相关阅读:
    leetcode59
    leetcode95
    leetcode96
    leetcode787
    leetcode150
    leetcode165
    leetcode739
    快速搭建:Djangorest-framework的restful项目
    编写部署用到的部分shell脚本收集
    pandas:dataframe删除某些不为non的行
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/1769065.html
Copyright © 2011-2022 走看看