固定文字数量,多余的显示"..."省略号的问题~

来源:百度知道 编辑:UC知道 时间:2024/06/04 22:18:24
if len(trim(rs("newsname")))<6 then

response.write ("<script>alert('您还是普通用户,请联系管理员');location.href='indexshop.asp';</script>")

else
response.write "left(trim(rs("newsname")),20)&"..."&"</a><br>"
end if

结果新闻里显示的所有条目都有 "..." 超过20个字的或没超过的...也就是第一个判断总是成立的,请问这个是为什么呢..

使用一个判断语句
判断字段内容是不是超过了20个字符
if len(trim(rs("newsname")))<6 then

response.write ("<script>alert('您还是普通用户,请联系管理员');location.href='indexshop.asp';</script>")

else
if len(trim(rs("newsname")))>=20 then
response.write "left(trim(rs("newsname")),20)&"..."&"</a><br>"
else
response.write "trim(rs("newsname"))</a><br>"
end if
end if
我不知道你前面的那个if len(trim(rs("newsname")))<6实干什么用的,似乎没有什么作用,难道字符数小于6的都是固定权限的用户?