在较长文章末添加“……”
网络整理 - 09-03
<%text=rs("content") 将数据库字段值赋到某变量上
i=10 定义固定大小
if len(text)>i then 如果文本长度大于给定的值
text=left(text,i) 则提取前段的i位的字符串
response.write (text&"...")
else
response.write (text)
end if
%>
为了方便,做成函数:
<%
function conleft(content,i)
if len(content)>i then
content=left(content,i)
response.write (content&"...")
else
response.write (content)
end if
end function
%>
以上为函数,下面就可以直接调用。
<%call conleft(rs("content"),10)%>
