如何限制显示新闻标题的字数?

sjm44 2003-09-26 09:16:29
我在有的网站上看见它们的新闻标题的显示有一定的字数限制,超过的部分用“.....”来显示,鼠标移动到上面后就可以显示标题的全部内容,请问用ASP如何来实现?谢谢!!
...全文
214 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
jueban9818 2003-10-08
  • 打赏
  • 举报
回复
len(trim(rs_news("title")))>25
jww330 2003-10-08
  • 打赏
  • 举报
回复
<a href="url" title=<%=rs_news("title")%>> '鼠标移动到上面后显示标题的全部内容
<%
if len(trim(rs_news("title")))>15 then
response.write left(rs_news("title"),15)&"…"
else
response.write trim(rs_news("title"))
end if
%>
</a>
pepos 2003-09-30
  • 打赏
  • 举报
回复
<%

if len(trim(rs_news("title")))>15 then
response.write left(rs_news("title"),15)&"…"
else
response.write trim(rs_news("title"))
end if

%>
xie12898 2003-09-30
  • 打赏
  • 举报
回复
<SPAN TITLE="查看作者信息">
<%
if then
left()
end if
%>

〈/span>
xie12898 2003-09-30
  • 打赏
  • 举报
回复
<SPAN TITLE="<%=rs("ss")%>">
<%if then
left()
end if
%></span>
zhanghao5188 2003-09-30
  • 打赏
  • 举报
回复
left()
dx 2003-09-29
  • 打赏
  • 举报
回复
用left函数就行了
avonqin 2003-09-29
  • 打赏
  • 举报
回复
javascript实现方法
chinanetspy 2003-09-29
  • 打赏
  • 举报
回复
给你一个函数
直接调用就可以了
function FormatTitle(str)
if len(trim(str))>=25 then
FormatTitle=left(trim(str),25)&"..."
else
FormatTitle=trim(str)&"..."
end if
end function
sjm44 2003-09-29
  • 打赏
  • 举报
回复
我用的是Dreamweaver MX做的ASP网页,用Javascript怎么实现呢?
wauo 2003-09-26
  • 打赏
  • 举报
回复
改一下,如下:
Dim MyString, LeftString
MyString = "VBSCript"
if len(MyString)>4 then
LeftString =left(MyString,3)&"…"
else
LeftString=MyString
end if
wauo 2003-09-26
  • 打赏
  • 举报
回复
<%if len(trim(rs_news("title")))>18 then
response.write left(rs_news("title"),17)&"…"
else
response.write trim(rs_news("title"))
end if
bonniewater 2003-09-26
  • 打赏
  • 举报
回复
Dim MyString, LeftString
MyString = "VBSCript"
LeftString = Left(MyString, 3) 'LeftString 包含 "VBS"。


28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧