日期:2014-05-17  浏览次数:20716 次

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> "  
      Response.Write   " <td   class=tl> &nbsp;. "&rs( "ggbt ")&rs(ggbt,17)& "&nbsp; </td> "  
Response.Write   " <td   class=tl> &nbsp;. "&rs( "ggbt ")& "&nbsp; </td> "  
  Response.Write   " </tr> "  
    rs.movenext
loop
if     rs.eof   and     rs.bof   then
Response.Write   " <font   color= " "#666666 " "> 目前尚无任何公告! </font> "
end   if
Response.Write   " </table> "  
Response.Write   " </div> "  
%>
</td>
</marquee>


------解决方案--------------------
输出的标题用left函数截取字符,比如,要截取字符串str的前50个字符,并且鼠标移到连接上,显示所有的str字符,就使用下面的代码
<a href= "index.aspx?id=.... " title= " <%=str%> "> <%=left(str,50)%> </a>
=========================
晕,开了两个帖子............