------------------ pagelist.asp --------------------------- <% gotopage=request("gotopage") cpage=request("cpage") if gotopage<>"" then cpage=gotopage if not isempty(cpage) then if isnumeric(cpage) then cpage=CInt(cpage) else cpage=1 end if else cpage=1 end if set rs=Server.CreateObject("Adodb.Recordset") sql="select * from [数据表] order by 字段" '改成你自己的SQL语句
rs.open sql,conn,1,1 if rs.recordcount>0 then rowcount=25 '每页显示25条 rs.pagesize=rowcount if cpage<1 then cpage=1 elseif cpage>rs.pagecount then cpage=rs.pagecount end if rs.absolutepage=cpage if cpage=rs.pagecount then itemcount=rs.recordcount mod rowcount if itemcount=0 then itemcount=rowcount else itemcount=rowcount end if else itemcount=0 end if %> <html> <script> function ItemChange(ThisName) { location.href("pagelist.asp?cpage=" + ThisName.options[ThisName.selectedIndex].value) } </script> <select onchange="javascript:ItemChange(this)" name="gopage"> <%for i = 1 to rs.pagecount%> <option value="<%=i%>" <%if cpage=i then response.write "selected"%>>第<%=i%>页</option> <%next%> </select> </html>