如果標題過長,因為頁面布局的限制,只能列表10個字符,這個函數(shù)會幫你實現(xiàn)的
復制代碼 代碼如下:
'截取字符串 strvalue(標題,字數(shù))
function strvalue(str,lennum)
dim p_num
dim i
if strlen(str)=lennum then
strvalue=str
else
p_num=0
x=0
do while not p_num > lennum-2
x=x+1
if asc(mid(str,x,1))0 then
p_num=int(p_num) + 2
else
p_num=int(p_num) + 1
end if
strvalue=left(trim(str),x)"…"
loop
end if
end function
function strlen(str)
dim page_len
page_len=0
strlen=0
if trim(str)>"" then
page_len=len(trim(str))
for xx=1 to page_len
if asc(mid(str,xx,1))0 then
strlen=int(strlen) + 2
else
strlen=int(strlen) + 1
end if
next
end if
end function
使用方法:
復制代碼 代碼如下:
%=strvalue("準確的編程語言,可正確對代碼語法著色,輸入簡單幾個字的代碼片段說明",10)%>
以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡。
您可能感興趣的文章:- ASP 時間函數(shù)及如何獲取服務器時間的寫法
- Asp Split函數(shù)之使用多個分割符的方法
- asp與js的類型轉(zhuǎn)換函數(shù)介紹
- asp中的Rnd 函數(shù)
- ASP轉(zhuǎn)換格林威治時間函數(shù)DateDiff()應用
- ASP移動文件函數(shù)movefile權(quán)限不足的替代方法
- ASP中實現(xiàn)的URLEncode、URLDecode自定義函數(shù)
- asp實現(xiàn)獲取MSSQL數(shù)據(jù)庫表指定條件行數(shù)的函數(shù)
- asp中實現(xiàn)清除html的函數(shù)
- ASP實現(xiàn)強制圖片下載函數(shù)
- ASP函數(shù)大全解析