28,409
社区成员




获取值,计算的
<%
dim maxperpage
dim totalPut
dim CurrentPage
'修改此处用于修改每页显示的留言数量
maxperpage=20
if not isempty(request("p")) then
currentPage=cint(request("p"))
'response.write request("p")
else
currentPage=1
end if
sqlb="select id,title,name,date from zf11_gb"
rs.open sqlb,conn,1,3
response.write currentPage
%>
<%
if not rs.eof then
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
ShowMes
call showpage (totalput,MaxPerPage,"")
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
response.write request("p")
dim bookmark
bookmark=rs.bookmark
ShowMes
call showpage (totalput,MaxPerPage,"")
else
currentPage=1
ShowMes
call showpage (totalput,MaxPerPage,"")
end if
end if
end if
%>
提交的下拉列表,下拉列表不再FORM里
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<table width='90%' border='0' align='center' cellpadding='3' cellspacing='0' class='BoderTab'>"
response.write "<form method=Post action="""&filename&"""><tr><td align=center>"
if CurrentPage<2 then
response.write "共<b><font color=red>"&totalnumber&"</font></b>条 首页 上一页 "
else
response.write "共<b><font color=red>"&totalnumber&"</font></b>条留言 "
response.write "<a href="&filename&"?O=1&p=1>首页</a> "
response.write "<a href="&filename&"?O=1&p="¤tPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?O=1&p="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?O=1&p="&n&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"¤tPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>条留言/页 "
%>
转到:
<select name='p' size='1' style="font-size: 9pt" onChange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>'<%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select>
<input type=hidden name="O" value=1>
<%
response.write "</td></tr></FORM></table>"
end Function
%>
if currentPage=1 then
ShowMes
call showpage (totalput,MaxPerPage,"")
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
response.write request("p")
dim bookmark
bookmark=rs.bookmark
ShowMes
call showpage (totalput,MaxPerPage,"")
else
currentPage=1
ShowMes
call showpage (totalput,MaxPerPage,"")
end if
if currentPage<>1 then
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
response.write request("p")
dim bookmark
bookmark=rs.bookmark
else
currentPage=1
end if
end if
ShowMes
call showpage (totalput,MaxPerPage,"")