只要把红色的套到你的网页中就可以
index.asp页面代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="page.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link type="text/css" href="main.css" rel="stylesheet" />
</head>
<body>
<!--#include file="toper.asp"-->
<!--博友列表-->
<div id="blog">
<h3>博友列表</h3>
<div>
<%
for i=1 to rs.pagesize
if rs.eof then exit for '如果没有数据就退出循环
%>
<dl>
<dt><%=rs("u_username")%></dt>
<dd><img src="<%=rs("u_face")%>" alt="<%=rs("u_username")%>" /></dd>
<dd>给他送花 | 写短信</dd>
<dd>加为好友 | 写留言</dd>
</dl>
<%
rs.movenext '每循环一次,指针直到下一条
next
%>
<!-----------------分页代码开始!--------------------->
<div id="page">
共有<font color="#FF0000"><%=rs.recordcount%></font>条数据
<%if rs.pagecount>0 then%>
当前<%=intpage%>/<%=rs.pagecount%>页
<%else%>
当前页0/0
<%end if%>
<!--------------------上面分页代码主要判断多少页现在在第几页!-------------------------->
<a href="blog.asp?page=1">首页</a>
<%if pre then%>
<a href="blog.asp?page=<%=intpage-1%>">上一页</a>
<%end if%>
<%if last then%>
<a href="blog.asp?page=<%=intpage+1%>">下一页</a>
<%end if%>
<a href="blog.asp?page=<%=rs.pagecount%>">尾页</a>
转到第
<select name="sel_page" οnchange="javascript:location=this.options[this.selectedIndex].value;" style="border:1px solid #ccc;">
<%
for i=1 to rs.pagecount '第1页到最后一页
if i=intpage then
%>
<option value="blog.asp?page=<%=i%>" selected="selected"><%=i%></option>
<%else%>
<option value="blog.asp?page=<%=i%>"><%=i%></option>
<%
end if
next 'for和next是一对,if和enf if是一对
%>
</select>
页
</div>
</div>
</div>
<!--#include file="footer.asp"-->
</body>
</html>
page.asp代码:这个页面你只要改数据库名称和id像我下面使用的就是u_id
<%dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select * from u_user order by u_id desc"
rs.PageSize = 28 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,1,3 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>