|
|
|
 |
|
|
|
|
<%
sql="select * from wz_twxx order by twsj desc"
set rs=conn.execute(sql)
if rs.eof then
%>
<%
else
const MaxPerPage=10
page=trim(request("page"))
if page<>"" then
'检测输入页数是否合法
pagestrlong=len(page)
chOK="0123456789"
chvalid=true
j=1
do while j<=pagestrlong
ch=mid(page,j,1)
If instr(chOK,ch)=0 then
chvalid=false
exit do
end if
j=j+1
loop
'检测完毕
if not chvalid then '如果不合法
currentPage=1 '默认为第1页
else
currentPage=int(page) '如果合法则取整数
if currentpage=0 then '如果是0页取1
currentpage=1
end if
end if
else
currentPage=1 '如果空白测取第1页
end if
i=0
do until rs.eof
i=i+1
rs.movenext
loop
rs.movefirst
totalPut=i '记录总数
'判断最大显示页数
if totalput<=maxperpage then
maxpagenum=1
else
pageys=totalput/maxperpage
if pageys > int(pageys) then
maxpagenum=int(pageys)+1
else
maxpagenum=int(pageys)
end if
end if
if currentPage=1 then
showContent
showpages
else
if (currentPage-1)*MaxPerPage>=totalPut then
currentPage=maxpagenum
end if
rs.move (currentPage-1)*MaxPerPage
showContent
showpages
end if
sub showContent
for i=1 to MaxPerPage
if rs.eof then exit for
%>
<%
rs.movenext
next
end sub
%>
<%
sub showpages ()
%>
<%
end sub
end if
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
|
|
|
|