ASP显示内容问题和用省略号显示

以下是我的一段代码,请问如何插入就可以让显示用户名的内容只限定在4-5个字内,多余用省略号显示。原代码:Response.Write("<tablewidth='100%... 以下是我的一段代码,请问如何插入就可以让显示用户名的内容只限定在4-5个字内,多余用省略号显示。

原代码:

Response.Write("<table width='100%' height='28' border='0' align='center' cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td height='28' background='images/r_top_bg.gif' style='padding-left:10px' class=ding3 style='background-repeat:no-repeat'><img src='Images/ico_blog.gif' width='16' height='16' /> 最新加入会员......</td>")
Response.Write("</tr>")
Response.Write("</table>")
'Call WoDig.Get_Line
Response.Write("<table cellSpacing=0 cellPadding=0 width='100%' border=0 background='images/r_a_bg.gif' style='background-repeat:repeat-y; padding:10px'>"&vbcr)
Response.Write("<tr>"&vbcr)
Set Rs_NewUser = Server.CreateObject("Adodb.recordset")
Sql_PaiMin = "SELECT Top 6 User_ID, User_CoolName, User_Photo ,User_SignInDate FROM WoWo_User Order By User_ID Desc"
Rs_NewUser.open Sql_PaiMin,conn
Z_IC = 0
while not Rs_NewUser.eof and Z_IC < 6
Z_IC = Z_IC + 1
Response.Write("<td>"&vbcr)
Response.Write("<div>"&vbcr)
Response.Write("<table border='0' cellpadding='0' cellspacing='1' bgcolor='#e1e1e1'>"&vbcr)
Response.Write("<tr>"&vbcr)
Response.Write("<td bgcolor='#FFFFFF' align='center'><a href='My.asp?User_ID="& Rs_NewUser("User_ID")&"' target='_blank'><img src='"&Rs_NewUser("User_Photo")&"' width='50' height='50' border='0' title='"&Rs_NewUser("User_CoolName")&" 用户在 "& Rs_NewUser("User_SignInDate") &" 注册!' /></a><br><a href='My.asp?User_ID="& Rs_NewUser("User_ID") &"' target='_blank' >"& Rs_NewUser("User_CoolName")&"</a></td>"&vbcr)
Response.Write("</tr>"&vbcr)
Response.Write("</table>"&vbcr)
Response.Write("</div>"&vbcr)
Response.Write("</td>"&vbcr)
if Z_IC Mod 3 = 0 then Response.Write("</tr><tr>")
Rs_NewUser.MoveNext
Wend
Rs_NewUser.close
Set Rs_NewUser = nothing
Response.Write("</table>"&vbcr)

以下是一个从网上找的显示省略号的代码:

src_Title = Rs("Src_Title")
if src_Title <> "" then
src_Title = Replace(src_Title,"'"," ")
src_Title = Server.HTMLEncode(src_Title)
end if
if len (Src_Title)>8 then
Src_Title=left(Src_Title,8)&".."
end if

请问我如何插入或有更好的告诉我..谢谢!
展开
 我来答
mngenius
2007-11-09 · TA获得超过3165个赞
知道大有可为答主
回答量:2192
采纳率:0%
帮助的人:0
展开全部
Response.Write("<table width='100%' height='28' border='0' align='center' cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td height='28' background='images/r_top_bg.gif' style='padding-left:10px' class=ding3 style='background-repeat:no-repeat'><img src='Images/ico_blog.gif' width='16' height='16' /> 最新加入会员......</td>")
Response.Write("</tr>")
Response.Write("</table>")
'Call WoDig.Get_Line
Response.Write("<table cellSpacing=0 cellPadding=0 width='100%' border=0 background='images/r_a_bg.gif' style='background-repeat:repeat-y; padding:10px'>"&vbcr)
Response.Write("<tr>"&vbcr)
Set Rs_NewUser = Server.CreateObject("Adodb.recordset")
Sql_PaiMin = "SELECT Top 6 User_ID, User_CoolName, User_Photo ,User_SignInDate FROM WoWo_User Order By User_ID Desc"
Rs_NewUser.open Sql_PaiMin,conn
Z_IC = 0
while not Rs_NewUser.eof and Z_IC < 6
Z_IC = Z_IC + 1
Response.Write("<td>"&vbcr)
Response.Write("<div>"&vbcr)
Response.Write("<table border='0' cellpadding='0' cellspacing='1' bgcolor='#e1e1e1'>"&vbcr)
Response.Write("<tr>"&vbcr)
Response.Write("<td bgcolor='#FFFFFF' align='center'><a href='My.asp?User_ID="& Rs_NewUser("User_ID")&"' target='_blank'><img src='"&Rs_NewUser("User_Photo")&"' width='50' height='50' border='0' title='"&Rs_NewUser("User_CoolName")&" 用户在 "& Rs_NewUser("User_SignInDate") &" 注册!' /></a><br><a href='My.asp?User_ID="& Rs_NewUser("User_ID") &"' target='_blank' >"& Rs_NewUser("User_CoolName")&"</a></td>"&vbcr)
Response.Write("</tr>"&vbcr)
Response.Write("</table>"&vbcr)
Response.Write("</div>"&vbcr)
Response.Write("</td>"&vbcr)
if Z_IC Mod 3 = 0 then Response.Write("</tr><tr>")
Rs_NewUser.MoveNext
Wend
Rs_NewUser.close
Set Rs_NewUser = nothing
Response.Write("</table>"&vbcr)

以下是一个从网上找的显示省略号的代码:

src_Title = Rs("Src_Title")
if src_Title <> "" then
src_Title = Replace(src_Title,"'"," ")
src_Title = Server.HTMLEncode(src_Title)
end if
if len (Src_Title)>8 then
Src_Title=left(Src_Title,8)&".."
end if

改为

Response.Write("<table width='100%' height='28' border='0' align='center' cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td height='28' background='images/r_top_bg.gif' style='padding-left:10px' class=ding3 style='background-repeat:no-repeat'><img src='Images/ico_blog.gif' width='16' height='16' /> 最新加入会员......</td>")
Response.Write("</tr>")
Response.Write("</table>")
'Call WoDig.Get_Line
Response.Write("<table cellSpacing=0 cellPadding=0 width='100%' border=0 background='images/r_a_bg.gif' style='background-repeat:repeat-y; padding:10px'>"&vbcr)
Response.Write("<tr>"&vbcr)
Set Rs_NewUser = Server.CreateObject("Adodb.recordset")
Sql_PaiMin = "SELECT Top 6 User_ID, User_CoolName, User_Photo ,User_SignInDate FROM WoWo_User Order By User_ID Desc"
Rs_NewUser.open Sql_PaiMin,conn
Z_IC = 0
while not Rs_NewUser.eof and Z_IC < 6
Z_IC = Z_IC + 1
Response.Write("<td>"&vbcr)
Response.Write("<div>"&vbcr)
Response.Write("<table border='0' cellpadding='0' cellspacing='1' bgcolor='#e1e1e1'>"&vbcr)
Response.Write("<tr>"&vbcr)
Response.Write("<td bgcolor='#FFFFFF' align='center'><a href='My.asp?User_ID="& Rs_NewUser("User_ID")&"' target='_blank'><img src='"&Rs_NewUser("User_Photo")&"' width='50' height='50' border='0' title='"&Rs_NewUser("User_CoolName")&" 用户在 "& Rs_NewUser("User_SignInDate") &" 注册!' /></a><br><a href='My.asp?User_ID="& Rs_NewUser("User_ID") &"' target='_blank' >"& Rs_NewUser("User_CoolName")&"</a></td>"&vbcr)
Response.Write("</tr>"&vbcr)
Response.Write("</table>"&vbcr)
Response.Write("</div>"&vbcr)
Response.Write("</td>"&vbcr)
if Z_IC Mod 3 = 0 then Response.Write("</tr><tr>")
Rs_NewUser.MoveNext
Wend
Rs_NewUser.close
Set Rs_NewUser = nothing
Response.Write("</table>"&vbcr)

src_Title = Rs_NewUser("User_CoolName")
if src_Title <> "" then
src_Title = Replace(src_Title,"'"," ")
src_Title = Server.HTMLEncode(src_Title)
end if
if len (Src_Title)>8 then
Src_Title=left(Src_Title,8)&".."
end if
匿名用户
推荐于2016-06-16
展开全部
<%
Response.Write("<table width='100%' height='28' border='0' align='center' cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td height='28' background='images/r_top_bg.gif' style='padding-left:10px' class=ding3 style='background-repeat:no-repeat'><img src='Images/ico_blog.gif' width='16' height='16' /> 最新加入会员......</td>")
Response.Write("</tr>")
Response.Write("</table>")
'Call WoDig.Get_Line
Response.Write("<table cellSpacing=0 cellPadding=0 width='100%' border=0 background='images/r_a_bg.gif' style='background-repeat:repeat-y; padding:10px'>"&vbcr)
Response.Write("<tr>"&vbcr)
Set Rs_NewUser = Server.CreateObject("Adodb.recordset")
Sql_PaiMin = "SELECT Top 6 User_ID, User_CoolName, User_Photo ,User_SignInDate FROM WoWo_User Order By User_ID Desc"
Rs_NewUser.open Sql_PaiMin,conn
Z_IC = 0
while not Rs_NewUser.eof and Z_IC < 6
Z_IC = Z_IC + 1
Response.Write("<td>"&vbcr)
Response.Write("<div>"&vbcr)
Response.Write("<table border='0' cellpadding='0' cellspacing='1' bgcolor='#e1e1e1'>"&vbcr)
Response.Write("<tr>"&vbcr)
Response.Write("<td bgcolor='#FFFFFF' align='center'><a href='My.asp?User_ID="& Rs_NewUser("User_ID")&"' target='_blank'><img src='"&Rs_NewUser("User_Photo")&"' width='50' height='50' border='0' title='"&Rs_NewUser("User_CoolName")&" 用户在 "& Rs_NewUser("User_SignInDate") &" 注册!' /></a><br><a href='My.asp?User_ID="& Rs_NewUser("User_ID") &"' target='_blank' >"& left(Rs_NewUser("User_CoolName"),5)&"</a></td>"&vbcr)
Response.Write("</tr>"&vbcr)
Response.Write("</table>"&vbcr)
Response.Write("</div>"&vbcr)
Response.Write("</td>"&vbcr)
if Z_IC Mod 3 = 0 then Response.Write("</tr><tr>")
Rs_NewUser.MoveNext
Wend
Rs_NewUser.close
Set Rs_NewUser = nothing
Response.Write("</table>"&vbcr)

以下是一个从网上找的显示省略号的代码:

src_Title = Rs("Src_Title")
if src_Title <> "" then
src_Title = Replace(src_Title,"'"," ")
src_Title = Server.HTMLEncode(src_Title)
end if
if len (Src_Title)>8 then
Src_Title=left(Src_Title,8)&".."
end if
%>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式