xiyou
- 管理员
- 16315
- 27099
- 2015-11-29
|
2#
t
T
发表于 2017-07-21 18:14
|显示全部
- <style>
- .hh_article{clear:both;} /*文章带置顶样式*/
- .hh_article li.tw{text-align:left;border:1px dotted #cccccc;border-width:0 0 1px 0;padding:5px 0 5px 0;overflow:hidden;} /*置顶通用样式*/
- .hh_article .tw .pic{float:left;margin:5px 10px 5px 0;border:1px solid #dddddd;display:inline}
- .hh_article .tw .title{text-align:left;line-height:25px;}
- .hh_article .tw .title a{font-weight:bold;padding-left:0px;font-size:14px;color: #cc0000}
- .hh_article .tw .introduct{padding:2px 5px 5px 0px;line-height:20px;color: #666666;}
- .hh_article .tw .pixc{float:right;width:30px;height:30px;border:1px solid #000}
- .hh_article li.normal{clear:both;height:40px;line-height:40px;text-align:left;overflow:hidden;}
- .hh_article .normal .title{float:left;text-align:left;padding:0 0 0 10px;background:url(images/article_arrow.gif) no-repeat left center;}
- .hh_article .normal .date{float:right;color: #666666;padding-right:2px}
- </style>
- <div class="hh_article">
- <ul>
- <%
- string istop="0",isgood="0",isnew="0",ishot="0";
- DataTable dt;
- DataRow dr;
- dt=Get_Data();
- for(int i=0;i<dt.Rows.Count;i++)
- {
- dr=dt.Rows[i];
- pic=dr["titlepic"].ToString();
- istop=dr["istop"].ToString();
- ishot=dr["ishot"].ToString();
- isgood=dr["isgood"].ToString();
- isnew=dr["isnew"].ToString();
- %>
- <%if(istop=="1"){%>
- <li class="tw">
- <span class="title"><a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span><span><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span><a href=""><img src="/e/images/diy/toip.jpg" class="pixc"></a>
- </li>
- <%}else if(isnew=="1"){%>
- <li class="tw">
- <span
- class="title"><a
- href="<%=Detail_Url(dr)%>" target="<%=Target%>"
- title="<%=Server.HtmlEncode(dr["title"].ToString())%>"
- style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span><span><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span><a
- href=""><img src="/e/images/diy/news.jpg"
- class="pixc"></a>
- </li>
- <%}else if(isgood=="1"){%>
- <li class="tw">
- <span
- class="title"><a
- href="<%=Detail_Url(dr)%>" target="<%=Target%>"
- title="<%=Server.HtmlEncode(dr["title"].ToString())%>"
- style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span><span><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span><a
- href=""><img src="/e/images/diy/isgood.jpg"
- class="pixc"></a>
- </li>
- <%}else if(ishot=="1"){%>
- <li class="tw">
- <span
- class="title"><a
- href="<%=Detail_Url(dr)%>" target="<%=Target%>"
- title="<%=Server.HtmlEncode(dr["title"].ToString())%>"
- style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span><span><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span><a
- href=""><img src="/e/images/diy/ishot.jpg"
- class="pixc"></a>
- </li>
- <%}else if(ishot=="1"&&istop=="1"){%> //热点和置顶
- <li class="tw">
- <span
- class="title"><a
- href="<%=Detail_Url(dr)%>" target="<%=Target%>"
- title="<%=Server.HtmlEncode(dr["title"].ToString())%>"
- style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span><span><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span><a
- href=""><img src="/e/images/diy/hottop.jpg"
- class="pixc"></a>
- </li>
- <%}else{%>
- <li class="normal"><span class="title">
- <a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
- <span class="date"><%=((DateTime)dr["thedate"]).ToString("MM-dd")%></span>
- <span class="clear"></span>
- </li>
- <%
- }
- }
- %>
- </ul></div>
- 这样的方法,用if...else...这样,不过这样代码很多,我也没写完,也很麻烦
复制代码
|