<SCRIPT type=text/javascript>var focus_width=350;var focus_height=260;var text_height=30;var swf_height = focus_height+text_height;var pics="http://10.20.22.21/wfcgweb/data/news/201104211114559928.jpg|http://10.20.22.21/wfcgweb/data/news/201105050330020772.jpg";var links="http://10.20.22.21/wfcgweb/data/news/201104211114559928.jpg|http://10.20.22.21/wfcgweb/data/news/201105050330020772.jpg";var texts="潍坊城管秒杀式罚款从拍照到贴罚单不超五秒|潍坊市城管执法局推行城管110快速处置机制";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=wmode value="transparent"><param name="movie" value="images/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');document.write('<param name="menu" value="false"><param name="wmode" value="opaque">');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/focus.swf" wmode="opaque"  FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" 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>');</SCRIPT>这是我的图片新闻的前台,现在我遇到个问题,就是图片下面的标题有的时候可以正常显示,有的时候则只显示上半部分或者干脆不显示,
下面是我的后台代码
pics += DsBm.Tables[0].Rows[i]["ImageUrl"].ToString().Replace("\\", "/") + "|";
                        links += DsBm.Tables[0].Rows[i]["ImageUrl"].ToString().Replace("\\", "/") + "|";
                        texts += DsBm.Tables[0].Rows[i]["title"].ToString() + "|";

解决方案 »

  1.   


    <script type="text/javascript">
                                    imgUrl1 = "<%=imgUrl[0]%>";
                                    imgtext1 = "<%=imgText[0] %>";
                                    imgLink1 = escape("<%=imgLink[0] %>");
                                    imgUrl2 = "<%=imgUrl[1] %>";
                                    imgtext2 = "<%=imgText[1] %>";
                                    imgLink2 = escape("<%=imgLink[1] %>");
                                    imgUrl3 = "<%=imgUrl[2] %>";
                                    imgtext3 = "<%=imgText[2] %>";
                                    imgLink3 = escape("<%=imgLink[2]%>");
                                    imgUrl4 = "<%=imgUrl[3] %>";
                                    imgtext4 = "<%=imgText[3] %>";
                                    imgLink4 = escape("<%=imgLink[3] %>");
                                    imgUrl5 = "<%=imgUrl[4] %>";
                                    imgtext5 = "<%=imgText[4]%>";
                                    imgLink5 = escape("<%=imgLink[4] %>");
                                    imgUrl6 = "<%=imgUrl[5] %>";
                                    imgtext6 = "<%=imgText[5] %>";
                                    imgLink6 = escape("<%=imgLink[5] %>");
                                    var focus_width = 235;
                                    var focus_height = 175;
                                    var text_height = 15;
                                    var swf_height = focus_height + text_height;                                var pics = imgUrl1 + "|" + imgUrl2 + "|" + imgUrl3 + "|" + imgUrl4 + "|" + imgUrl5 + "|" + imgUrl6;
                                    var links = imgLink1 + "|" + imgLink2 + "|" + imgLink3 + "|" + imgLink4 + "|" + imgLink5 + "|" + imgLink6;
                                    var texts = imgtext1 + "|" + imgtext2 + "|" + imgtext3 + "|" + imgtext4 + "|" + imgtext5 + "|" + imgtext6;                                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/focus.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=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '">');
                                    document.write('</object>');
    </script>后台:
    /// <summary>
    /// 幻灯片新闻
    /// </summary>
    /// <returns></returns>
    public string[] getFlashNewsImageUrl()
    {
    Data dt = new Data();
    DataSet ds = dt.GetItemBytype();
    string[] news = new string[ds.Tables[0].Rows.Count];
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    string Item_url = ds.Tables[0].Rows[i]["p_pic"].ToString();//图片新闻路径
    news[i] = Item_url;
    }
    return news;
    } public string[] getFlashNewsImageText()
    {
    Data dt = new Data();
    DataSet ds = dt.GetItemBytype();
    string[] news = new string[ds.Tables[0].Rows.Count];
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    string newitem = ds.Tables[0].Rows[i]["p_name"].ToString();
    if (newitem.Length > 20)
    {
    newitem = newitem.Substring(0, 16) + "...";
    }
    string Itemtitle = newitem;//图片新闻标题 itemtitle
    news[i] = newitem;
    }
    return news;
    } public string[] getFlashNewsImageLink()
    {
    Data dt = new Data();
    DataSet ds = dt.GetItemBytype();
    string[] news = new string[ds.Tables[0].Rows.Count];
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    string Link = "ItemsContent/NewCont.aspx?nowmenuid=4&p_id=" + ds.Tables[0].Rows[i]["p_id"].ToString();//图片新闻链接地址
    news[i] = Link;
    }
    return news;
    }