<!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><style type="text/css"><!--dl dd a { font-size:13px; color:#004600; text-decoration:none;}dl dd span { padding:10px; color:#FF0000; font-size:12px; font-weight:bold;}ul { list-style-type:none; overflow:hidden;}ul li { float:left; border:0; margin:0; padding:0; }ul li a { display:block; width:25px; height:20px; border:solid 1px #9aafe5;margin-right:2px; text-decoration:none; font-size:12px; line-height:20px; text-align:center; font-weight:500;font-weight:bold;color:#006799;}ul #AbsPage a { background:#006799; color:#FFFFFF;}ul #NextPage a { width:45px; height:20px; font-size:12px; color:#006799;}ul #PreviousPage a { width:65px; height:20px; font-size:12px;color:#006799;} --></style></head><body><%dim conn,connstr,rs,sqldatabase = "DataBase/test.mdb"Set conn = Server.CreateObject("ADODB.Connection")connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(database)conn.open connstrSet rs = Server.Createobject("ADODB.Recordset")sql="select id,title from news"rs.open sql,conn,1,1If rs.eof ThenElse rs.pagesize=3 page=request.querystring("page") If Not Isnumeric(page) or page="" Then page=1 else page=cint(page) End if if page<1 then page=1 if page>rs.pagecount then page=rs.pagecount rs.AbsolutePage = page for i=1 to rs.pagesize title = rs("title") %> <dl> <dd><span><%=rs("id")%></span><a href="#"><%=rs("title")%></a> </dd> </dl> <% rs.movenext if rs.eof then Exit For End if nextend if%> <ul> <% if page>3 then StartPage=page-3 else StartPage=1if page<rs.pagecount-3 then EndPage=page+3 else EndPage=rs.pagecountif StartPage>=3 then response.write "<li id='PreviousPage'><a href=page.asp?page="&page-1&">Previous</a><span></span></li>"for j=StartPage to EndPage if j=page then response.write "<li id='AbsPage'><a href=page.asp?page="&j&">"&j&"</a></li>" else response.write "<li><a href=page.asp?page="&j&">"&j&"</a></li>" end ifnextif EndPage<rs.pagecount then response.write "<li id='NextPage'><a href=page.asp?page="&page+1&">Next</a><span></span></li>"rs.close %> </ul></body></html><%set rs=nothing%>