<% set rs=server.createobject("adodb.recordset") sqltext="select * from Data order by ID desc" rs.open sqltext,conn,1 dim MaxPerPage MaxPerPage=20 dim text,checkpage text="0123456789" Rs.PageSize=MaxPerPage for i=1 to len(request("page")) checkpage=instr(1,text,mid(request("page"),i,1)) if checkpage=0 then exit for end if next If checkpage<>0 then If NOT IsEmpty(request("page")) Then CurrentPage=Cint(request("page")) If CurrentPage < 1 Then CurrentPage = 1 If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount Else CurrentPage= 1 End If If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if Else CurrentPage=1 End if %>
<% If rs.eof and rs.bof then response.write "

目前沒有還有資料~~~!!!" End if %> <% row_count=1 Sub list() %> <% i=0 do while not rs.eof %>

<%if row_count mod 1 = 0 then%><%end if%> <% i=i+1 if i >= MaxPerpage then exit do rs.MoveNext row_count=row_count+1 Loop end Sub %> <% call list If Rs.recordcount > MaxPerPage then call showpages End if %>

編 號

刊 登 主 題

刊 登 日 期

<%=rs("ID")%>  .htm"><%=rs("Title")%> <%=rs("Time")%>
<%End Sub%>
<% Response.write "請選擇:" If currentpage > 1 Then response.write "| 首頁 " Response.write "| 上一頁 " Else Response.write "| 首頁 " Response.write "| 上一頁 " End if If currentpage < Rs.PageCount Then Response.write "| 下一頁 " Response.write "| 最尾頁 |" Else Response.write "| 下一頁 " Response.write "| 最尾頁 | " End if Response.write " 頁次:" & "" & Cstr(CurrentPage) & "" & "/" & Cstr(Rs.pagecount) & "  每頁" Response.write "" & Cstr(MaxPerPage) & "" & " 筆資料/頁 " & "共 " & "" & Cstr(Rs.RecordCount) & "" & " 筆資料  " %> <%sub showpages()%>