asp中新闻标题省略的问题
我做了一个公告 可是标题显示太长了我想让太长的标题只显示前面几个字符后面的用省略号 而且鼠标放在上面能显示全部! 那位大哥能帮我一下 公告代码如下
<td width= "169 " background= "img/b4.GIF " height= "35 "> 网站公告 </td>
<td>
<MARQUEE id=scrolltext onMouseOver=this.stop() onMouseOut=this.start() scrollAmount=1 scrollDelay=30 direction=up width=176 height=130 name= "scrolltext ">
<% exec= "SELECT top 3 * FROM gg order by id DESC "
set rs=server.createobject( "adodb.recordset ")
rs.open exec,conn,1,1
Response.Write " <div align= " "left " "> " & vbCrLf
Response.Write " <table border= " "0 " " cellpadding= " "0 " " cellspacing= " "1 " " height= " "160 " " width= " "194 " "> " & vbCrLf
do while not rs.eof
Response.Write " <tr> " & vbCrLf
if len(ggbt)> 12 then
Response.Write " <td class=tl> . "&rs( "ggbt ")&rs(ggbt,17)& " </td> " & vbCrLf
else
Response.Write " <td class=tl> . "&rs( "ggbt ")& " </td> " & vbCrLf
end if
Response.Write " </tr> " & vbCrLf
rs.movenext
loop
if rs.eof and rs.bof then
Response.Write " <font color= " "#666666 " "> 目前尚无任何公告! </font> "
end if
Response.Write " </table> " & vbCrLf
Response.Write " </div> " & vbCrLf
%>
</td>
</marquee>
------解决方案--------------------输出的标题用left函数截取字符,比如,要截取字符串str的前50个字符,并且鼠标移到连接上,显示所有的str字符,就使用下面的代码
<a href= "index.aspx?id=.... " title= " <%=str%> "> <%=left(str,50)%> </a>
------解决方案-------------------- 输出的标题用left函数截取字符,比如,要截取字符串str的前50个字符,并且鼠标移到连接上,显示所有的str字符,就使用下面的代码
<a href= "index.aspx?id=.... " title= " <%=str%> "> <%=left(str,50)%> </a>
------解决方案--------------------中英文混合的截字符串截取函数
Function CountLength(Str)
Dim output,ThisChar,i
output = 0
For i = 1 To Len(Str)
ThisChar = Mid(Str,i,1)
If Asc(ThisChar) < 0 Then
output = output + 2
Else
output = output + 1
End If
Next
CountLength = output
End Function
Function MaxLengthStr(ByVal Str, ByVal MaxLength)
Dim Output,i
If IsNull(Str) Then Str = " "
Output = " "
If LenB(Str) <= MaxLength Then
Output = Str
Else
For i = 1 To Len(Str)
Output = Output & Mid(Str,i,1)
If CountLength(Output)+3 = MaxLength Then
Outpu