Salad UN

To Taste The Salad Of Life.

« Seo工具收集(4)ASP应用中的应用函数 »

ASP限制标题字数

[ At 2008-7-31 By Ash   1 comments ]

ASP限制标题字数

function GetString(str,strlen)
dim l,t,c, i
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
GetString=left(str,i)&"..."
exit for
else
GetString=str&" "
end if
next
end function

这个函数可以搞定
把这个函数加在set com前边然后
把<%response.write rs(1)%>替换成<%=GetString(rs(1),数字)%>
就可以了。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80722 Code detection by Codefense

Copyright 2008 www.s-un.cn. Some Rights Reserved.