table width=100%> tr> td>新聞編號/td> td>新聞標題/td> td>發(fā)布日期/td> tr> % If Not Rs_News.eof Do while Not Rs_News.eof and RowCount>0 %> tr> td>%=Rs_News("ID")%>/td> td>%=Rs_News("Name")%>/td> td>%=Rs_News("Date")%>/td> tr> % RowCount = RowCount - 1 Rs_News.MoveNext Loop End If %>
修正: % If Not Rs_News.eof then Do while Not Rs_News.eof and RowCount>0 %>
而那個公共模塊缺form>,改后: % Sub TurnPage(ByRef Rs_tmp,PageSize) 'Rs_tmp 記錄集 ; PageSize 每頁顯示的記錄條數(shù); Dim TotalPage '總頁數(shù) Dim PageNo '當前顯示的是第幾頁 Dim RecordCount '總記錄條數(shù) Rs_tmp.PageSize = PageSize RecordCount = Rs_tmp.RecordCount TotalPage = INT(RecordCount / PageSize * -1)*-1 PageNo = Request.QueryString ("PageNo") '直接輸入頁數(shù)跳轉(zhuǎn); If Request.Form("PageNo")>"" Then PageNo = Request.Form("PageNo") '如果沒有選擇第幾頁,則默認顯示第一頁; If PageNo = "" then PageNo = 1 If RecordCount > 0 then Rs_tmp.AbsolutePage = PageNo End If '獲取當前文件名,使得每次翻頁都在當前頁面進行; Dim fileName,postion fileName = Request.ServerVariables("script_name") postion = InstrRev(fileName,"/")+1 fileName = Mid(fileName,postion) %> table border=0 width='100%'> tr> td width="258" align=left> 總頁數(shù):font color=#ff3333>%=TotalPage%>/font>頁 當前第font color=#ff3333>%=PageNo%>/font>頁 總共%=RecordCount%>條 /td> td width="308" align="right"> div align="center"> %If RecordCount = 0 or TotalPage = 1 Then Response.Write "首頁|前頁|后頁|末頁" Else%> a href="%=fileName%>?PageNo=1">首頁|/a> %If PageNo - 1 = 0 Then Response.Write "前頁|" Else%> a href="%=fileName%>?PageNo=%=PageNo-1%>">前頁|/a> %End If