日期:2014-05-17 浏览次数:21440 次
<%
If Not rs.eof or not rs.bof Then
idx=1
Do While Not rs.eof
%>
<tr>
<td width="30" class="jiage" align="center"><img src="Images/in_5.gif" width="10" height="10"></td>
<td width="611" class="jiage"><a href='qyxw_view.asp?hid=<%=rs("id_xl")%>' class="link"><%=left(rs("title_xl"),17)%></a><%if idx<4 then response.write "<img src='new图片路径'/>"%></td>
</tr>
rs.movenext
idx=idx+1
Loop
else
%>
<font> 暂无信息</font>
<%
End If
rs.close
set rs=nothing
%>
------解决方案--------------------
1.强烈建议不要截取字符,使用css来隐藏多余字符。
2.代码写工整点
<%
If Not rs.eof or not rs.bof Then
i=0
Do While Not rs.eof
i=i+1
Response.write "<tr><td width='30' class='jiage' align='center'><img src='Images/in_5.gif' width='10' height='10'></td>"
Response.write "<td width='611' class='jiage'><a href='qyxw_view.asp?hid="&rs("id_xl")&"' class='link'>"&rs("title_xl")&"</a>"
if i<4 then Response.write "<img src='Images/news.gif' width='10' height='10'>" '最新图标
Response.write "</td></tr>"&vbcrlf
rs.movenext
Loop
else
Response.write "暂无信息"
End If
rs.close
set rs=nothing
%>
<style type="text/css">
.link{
display: inline-block;
width:600px;/*调整宽度*/
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>