新闻标题太长加省略号和对内容太长分页

function getFileExtName(fileName)
    dim pos
    pos=instrrev(filename,".")
    if pos>0 then
        getFileExtName=mid(fileName,pos+1)
    else
        getFileExtName=""
    end if
end function

Function InterceptString(txt,length)
txt=trim(txt)
x = len(txt)
y = 0
if x >= 1 then
for ii = 1 to x
if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then
   y = y + 2
else
   y = y + 1
end if
  if y >= length then
     txt = left(trim(txt),ii-2)&"..." '字符串限长
  exit for
end if
next
   InterceptString = txt
else
   InterceptString = ""
end if
End Function

'****************************************************
'过程名:page
'作  用:文章分页
'参  数:无
'****************************************************

function ContentPage(str,fontnum)
if len(str)>fontnum then
if len(str) mod fontnum>0 then '计算总页数
pagecontent=len(str)\fontnum+1
else
pagecontent=len(str)\fontnum
end if

Dim arr()
ReDim arr(pagecontent)

for m = 1 to pagecontent
if m<>pagecontent then
arr(m)= mid(str,(m*fontnum-fontnum+1),fontnum)
else
arr(m)= mid(str,(m*fontnum-fontnum+1),len(str))
end if
next

if Request.QueryString("page")<>"" then
Response.Write(arr(Request.QueryString("page")))
else
Response.Write(arr(1))
end if

Response.Write("<p>")
Response.Write("<p>")
Response.Write("<p>")
for i = 1 to pagecontent
Response.Write("<font size=2><a href=?articleID="&dy&"&page="&i&">第"&i&"页</a></font> ")
next
else
Response.Write(str)
end if
end function

 

'*********************

'方法二:新闻内容分页

Function   PageList(str)  
  content=str  
  if   request.QueryString("page")=""   then  
  page=1  
  else  
  page=cint(request.QueryString("page"))    
  end   if  
  chenda=split(content,"[PageList]")  
  content=chenda(page-1)  
  response.Write   content  
  response.Write   "<p   align=center>本文共分:"  
  For   i   =   0   to   ubound(chenda)  
  response.Write   "<a   "  
  if   i=page-1   then   response.Write   "   style='color:red'   "  
  response.Write "<a href=ArticleShow.asp?articleID="&request("articleID")&"&page="&i+1&">"&i+1&"</a> "  
  Next  
  response.Write   "页</p>"  
  end   Function

posted @ 2008-09-26 18:50  Lee Vane  阅读(379)  评论(0)    收藏  举报