老程序SXWO简单版, 在分页超过9页时, 页数出现负数, 如 -3 -2 -1 0 1 2 3 , 把CREATEPAGECOMMON.ASP 的(totalrecord,12) 修改为 (totalrecord,30), 错误休正。
function getindex(spageid)
dim spagenum,startpage,i
spagenum=15 '15
startpage=0
set p_rs=server.createobject("adodb.recordset")
p_sql="select id from down"
p_rs.open p_sql,conn,1,1
totalrecord=p_rs.recordcount
totalpage=chu(totalrecord,30) 'totalpage=chu(totalrecord,12)ԭ
getindex="<b>Page "&spageid+1&" of "&totalpage&"</b> "
if spageid-int(spagenum/2)<=0 then
startpage=0
else
if totalpage-spageid>int(spagenum/2) then
startpage=spageid-int(spagenum/2)
else
startpage=totalpage-spagenum
end if
end if
if startpage>0 then
getindex=getindex&"<a href=index"&spageid-1&".htm>Previous</a> "
end if
for q=startpage to totalpage-1
q1=q
if q1=0 then q1=""
i=i+1
if q=spageid then
getindex=getindex&"<b>"&q+1&"</b> "
else
getindex=getindex&"<a href=index"&q1&".htm><u>"&q+1&"</u></a> "
end if
if i>=spagenum then exit for
next
if q<totalpage-1 then
getindex=getindex&"<a href=index"&spageid+1&".htm>Next</a> "
end if
p_rs.close
set p_rs=nothing
end function