中国中药协会王桂华:asp中如何控制显示字符的长度?求助

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 04:50:30
比如这段代码,应该如何改才对。我很菜,希望顺便能帮解释一下,先谢过了。
<%
sqltext="select * from upfile "
rs.Open sqltext,cn,1,1
do while not rs.EOF
%>
<tr>
<td class="font1" height=20><img src="images/point_news.gif" width="12" height="12"> <%=trim(rs("title"))%> [<a class=more href="Javascript:down_login('<%=rs("keyno")%>')">下载</a>]</td>
</tr>
<%
rs.MoveNext
loop
rs.Close
%>

<%=trim(rs("title"))%>修改: <%=Left(trim(rs("title")),X)%>X是要显示的字符数,例如:<%=Left(trim(rs("title")),12)%>

<%
sqltext="select * from upfile "
rs.Open sqltext,cn,1,1
While Not rs.Eof
%>
<tr>
<td class="font1" height=20><img src="images/point_news.gif" width="12" height="12"> <%If len(rs("Title"))>15 Then '长度>15
Response.Write(left(rs("Title"),13)&"...") '用前13个字符加...显示
ElseResponse.Write(rs("Title"))
End If %>
[<a class=more href="Javascript:down_login('<%=rs("keyno")%>')">下载</a>]</td>
</tr>
<%
rs.movenext
Wend
Set rs=Nothing
conn.Close
Set conn=Nothing
%>

...wen ti duo O~~!