2005-9-14 一个简单的分页(代码片断)
<%
IF not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Then
page=1
Else
Page=Int(Abs(Request("page")))
End if
Dim Steps,Start,Ended,Counts,pagesize
Steps = 4
Counts = UBOUND(I_Choice,2)
pagesize = (Counts+1)\Steps + 1
If page = 1 Then
Start = 0
Ended = Steps - 1
Else
Start = (Page - 1)*Steps
Ended = Page*Steps - 1
End if
if Ended > Counts Then
Ended = Counts
End if
for Y = Start to Ended step 1
'调用相关资料信息
……
%>
<table width="602" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
…… HTML ……
</table>
<%Next%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<%
if page > 1 then
Response.write "<a href='?Act=All&page=1'>首页</a>"
Else
Response.write "<font color='#cccccc'>首页</font>"
End if
Response.write " | "
if page < pagesize then
Response.write "<a href='?Act=All&page="& page + 1 &"'>下一页</a>"
Else
Response.write "<font color='#cccccc'>下一页</font>"
End if
Response.write " | "
if page >1 then
Response.write "<a href='?Act=All&page="& page - 1 &"'>上一页</a>"
Else
Response.write "<font color='#cccccc'>上一页</font>"
End if
Response.write " | "
if page < pagesize then
Response.write "<a href='?Act=All&page="& pagesize &"'>尾页</a>"
Else
Response.write "<font color='#cccccc'>尾页</font>"
End if
%>
</td>
</tr>
</table>
另一个简单的分页
if rs.eof and rs.bof then
errormsg = " "
else
pagepath = "?method=accounts&accID=" & accId
IF not IsNumeric(Request("contpage")) Or IsEmpty(Request("contpage")) Then
contpage=1
Else
contPage=Int(Abs(Request("contpage")))
End if
rs.pagesize =8
total = rs.RecordCount
mypagesize=rs.pagesize
rs.absolutepage = contpage
end if
……
<%if contpage>1 then%>
<img src="image/start.gif" width="9" height="8"><a href="<%=pagepath%>&contpage=1"><span class="style20"> Start </span></a>
<%else%>
<img src="image/start_off.gif" width="9" height="8"><a href="<%=pagepath%>&contpage=1"><span class="style18"> Start </span></a>
<%end if%>
<%if contpage>1 then%>
<img src="image/previous.gif" width="4" height="8"><a href=<%=pagepath%>&contpage=<%=contpage-1%>><span class="style20"> Previous </span></a>
<%else%>
<img src="image/previous_off.gif" width="4" height="8"><span class="style18"> Previous </span></a>
<%end if%>
<span class="style20">
( <%=rs.pagecount%> - <%=contpage%> of <%=total%> )
</span>
<%if contpage<rs.pagecount then%>
<img src="image/next.gif" width="4" height="8"><a href=<%=pagepath%>&contpage=<%=contpage+1%>><span class="style20"> Next </span></a>
<%else%>
<img src="image/next_off.gif" width="4" height="8"><span class="style18"> Next </span></a>
<%end if%>
<%if contpage<rs.pagecount then%>
<a href=<%=pagepath%>&contpage=<%=rs.pagecount%>><span class="style20"> End </span></a><img src="image/end_1.gif" width="9" height="8">
<%else%>
<span class="style18"> End </span></a><img src="image/end_off.gif" width="9" height="8">
<%end if%>
……
浙公网安备 33010602011771号