<%
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
PageNumberPageNumber=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
%>