图片轮播

<div id="image" style="float: left; height: 256px; width: 334px;">
                        <% 
                          var dtpic =obj;//获取要轮播显示的图片列表
                          if (dtpic.Count != 0)
                          {
                              int num = 0;//图片数量计数器
                              int i = 0;//当前数据编号
                              string imgUrl = "";
                              string imgLink = "";
                              string imgTitle = "";
                              while (num < 6)
                              {
                                  if (i == dtpic.Count)
                                  {
                                      num = 6;
                                  }
                                  else
                                  {
                                      string picUrl = dtpic[i].Imagesaddress.Trim();
                                      string picLink = "Module/OfficeAuxiliary/O_News_Show.aspx?id=" + dtpic[i].Id.Trim();
                                      string picTitle = dtpic[i].Title.Trim();
                                      if (!string.IsNullOrEmpty(picUrl))
                                      {
                                          if (picUrl.Split('.')[picUrl.Split('.').Length - 1].ToLower() == "jpg" || picUrl.Split('.')[picUrl.Split('.').Length - 1].ToLower() == "gif")
                                          {
                                              imgUrl += picUrl + "|";
                                              imgLink += picLink + "|";
                                              imgTitle += picTitle + "|";
                                              num++;
                                          }
                                      }
                                      i++;
                                  }
                              }
                              imgUrl = imgUrl.Substring(0, imgUrl.Length - 1);
                              imgLink = imgLink.Substring(0, imgLink.Length - 1);
                              imgTitle = imgTitle.Substring(0, imgTitle.Length - 1);
                              Response.Write("<script type='text/javascript'>default_GetXml('" + imgUrl + "','" + imgLink + "','" + imgTitle + "','334','230','26','image')</script>");
                          }
                            %>
                    </div>
posted @ 2016-08-31 16:11  Tz__C  阅读(165)  评论(0编辑  收藏  举报