Class Seaoh_com
Public Function Go()
iLen=0
Enter=0
Sql = "select top 20 * from News where id>0 order by id"
Rs.Open Sql,Conn,3
while not Rs.eof
if Enter>16 then
rs.movenext
else
if rs("HtmlPath")="" then HtmlPath="/News/Show.asp?id="&rs("id") else HtmlPath="/Html/"&rs("HtmlPath") end if
tl=Rs("Title")
sLen=GetLen(tl)
if iLen<=44 then
if iLen>=40 then
if iLen>=41 then
if iLen>42 then Response.Write"<br>" else Response.Write"评<br>" end if
else
Response.Write"评论<br>"
end if
iLen=0
Enter=Enter+1
else
if sLen<44-iLen then
Response.Write "<a href="""&HtmlPath&""" target=""_blank"">"&tl&"</a> "
iLen=iLen + sLen + 1
else
Response.Write "<a href="""&HtmlPath&""" target=""_blank"">"&SetLen(tl,43-iLen)&"</a><br>"
iLen=0
Enter=Enter+1
end if
rs.movenext
end if
end if
end if
wend
End Function
function GetLen(str)
gsLen=Len(str)
grLen=0
for gi=1 to gsLen
grstr=Mid(str,gi,1)
grLen=grLen + Len(Hex(Asc(grstr)))
next
GetLen=Int(grLen/2)
end function
function SetLen(str,Length)
ssLen=Len(str)
for si=1 to ssLen
srstr=Mid(str,si,1)
srLen=srLen + Len(Hex(Asc(srstr)))/2
if srLen<Length+1 then
SetLen=SetLen & srstr
else
exit for
end if
next
end function
End Class