<% dim exec, rs, page, recordcount dim pagecount, strPageList exec="select * from ly where jh=1 order by id desc" Set RS = Server.CreateObject("ADODB.RecordSet") rs.Open exec, Conn, 0, 1 exec="select top 1 bestNum from const" set rs=conn.execute(exec) RecordCount=rs(0) rs.close page=encodestr(Request.querystring("page")) if page="" or not isNumeric(page) then page=1 else page=int(page) end if pageCount=RecordCount/rcPerPage pageCount=int(pageCount) if (RecordCount mod rcPerPage)>0 then PageCount=PageCount +1 end if if page>pageCount then page=pageCount end if %> <%=sitetitle%> <% strPageList=pageList() response.write strPageList if page<=1 then exec="select top "&rcPerpage&" * from ly where jh=1 order by id desc" else exec="select top "&rcPerpage&" * from ly where jh=1 and id <%else %> <%end if response.write strPageList function pageList() dim p,i if page<1 then page=1 end if if pagecount<1 then pagecount=1 end if pageList="" pageList=pageList & "" pageList=pageList & "
共有精华 "& RecordCount &" 个,共 "& pageCount &"" if page=1 then pageList=pageList & " 留言首页" else pageList=pageList & " 第一页" end if if page=1 then pageList=pageList & " 前一页" else pageList=pageList & " 前一页" end if if pagecount-page=0 then pageList=pageList & " 下一页" else pageList=pageList & " 下一页" end if pageList=pageList & "" 'pagecount=2 p=int(page/pageLinkNum) if page mod pageLinkNum>0 then p=p+1 end if p=(p-1)*pageLinkNum+1 'response.write p 'response.end i=p+(pageLinkNum-1) if i> pagecount then i=pagecount end if if p>pageLinkNum then pageList=pageList & "[<<]" end if do while p<=i if p=page then pageList=pageList & "["&p&"]" else pageList=pageList & "["&p&"]" end if p=p+1 loop p=p-1 if p< pagecount then pageList=pageList & "[>>]" end if pageList=pageList & "
" end function %>