<%
Sub AutoPage ()
Dim Maxpagelen,page,content,pagenumber,articleid
Dim Contentlen
Dim beginpoint,endpoint
Maxpagelen=1000
content=Ubbcode(rs ("content"))
ArticleID=rs("ArticleID")
contentlen=len (content)
page=request. QueryString ("page")
If Contentlen<=maxpagelen Then
Response. Write Content
Else
If page="" Then
page=1
Else
page=Cint(page)
End If
If Pagenumber*maxpagelen<Contentlen Then
pagenumber pagenumber=pagenumber+1
End If
pagenumber=int(Contentlen/maxpagelen) +1
If page<1 then page=1
If page>pagenumber then page=pagenumber
If page=1 Then
beginpoint=1
Else
beginpoint=maxpagelen* (page-1) +1
End If
If page=pagenumber Then
EndPoint=Contentlen
Else
EndPoint=Maxpagelen*page
If EndPoint>=contentlen Then
EndPoint=Contentlen
End If
End If
content=Mid(content,beginpoint,endpoint-beginpoint)
Response. Write Content
Response. Write "<br>"
Response. Write "<br>"
Response. Write "<br>"
End If
For i=1 to PageNumber
Response. Write "<a href=articele. asp? ArticleID="& ArticleID &"&page="& I &"> "& I &"</a>"
Next
End Sub
%>