• 动态绑定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;
                  
        }

  • 相关阅读:
    C++ 函数设计原则
    C++ 转换函数搭配友元函数
    C++ 自动转换和强制类型转换(用户自定义类类型)
    C++ rand函数
    C++ 状态成员
    C++ 友元函数
    C++ 运算符重载
    RabbitMQ的简单应用
    Python的正则表达式
    Python的应用小案例
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/1769065.html
Copyright © 2020-2023  润新知