|
这是一个用下拉菜单来做翻页的通用代码,我觉得这样做比较省空间,蛮好的 其实这个代码就是老外的那个翻页插件,后来是哪位好朋友(不好意思,忘了)修改后放在论坛上的,我还做成过插件,其实光是拷贝也挺方便的。 还有最后一段是前后翻页的按钮,呵呵,这个还是ccjat提醒后加上的,用不用都随便咯。 <% 记录集名字_total = 记录集名字.RecordCount If (记录集名字_numRows < 0) Then 记录集名字_numRows = 记录集名字_total Elseif (记录集名字_numRows = 0) Then 记录集名字_numRows = 1 End If 记录集名字_first = 1 记录集名字_last = 记录集名字_first + 记录集名字_numRows - 1 If (记录集名字_total <> -1) Then If (记录集名字_first > 记录集名字_total) Then 记录集名字_first = 记录集名字_total If (记录集名字_last > 记录集名字_total) Then 记录集名字_last = 记录集名字_total If (记录集名字_numRows > 记录集名字_total) Then 记录集名字_numRows = 记录集名字_total End If %> <% If (记录集名字_total = -1) Then 记录集名字_total=0 While (Not 记录集名字.EOF) 记录集名字_total = 记录集名字_total + 1 记录集名字.MoveNext Wend If (记录集名字.CursorType > 0) Then 记录集名字.MoveFirst Else 记录集名字.Requery End If If (记录集名字_numRows < 0 Or 记录集名字_numRows > 记录集名字_total) Then 记录集名字_numRows = 记录集名字_total End If 记录集名字_first = 1 记录集名字_last = 记录集名字_first + 记录集名字_numRows - 1 If (记录集名字_first > 记录集名字_total) Then 记录集名字_first = 记录集名字_total If (记录集名字_last > 记录集名字_total) Then 记录集名字_last = 记录集名字_total End If %> <% Set MM_rs = 记录集名字 MM_rsCount = 记录集名字_total MM_size = 记录集名字_numRows MM_uniqueCol = "" MM_paramName = "" MM_offset = 0 MM_atTotal = false MM_paramIsDefined = false If (MM_paramName <> "") Then MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "") End If %>
<% if (Not MM_paramIsDefined And MM_rsCount <> 0) then r = Request.QueryString("index") If r = "" Then r = Request.QueryString("offset") If r <> "" Then MM_offset = Int(r) [page_break]If (MM_rsCount <> -1) Then If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region MM_offset = MM_rsCount - (MM_rsCount Mod MM_size) Else MM_offset = MM_rsCount - MM_size End If End If End If i = 0 While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1)) MM_rs.MoveNext i = i + 1 Wend If (MM_rs.EOF) Then MM_offset = i ' set MM_offset to the last possible record End If %> <% If (MM_rsCount = -1) Then i = MM_offset While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size)) MM_rs.MoveNext i = i + 1 Wend If (MM_rs.EOF) Then MM_rsCount = i If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount End If If (MM_rs.EOF And Not MM_paramIsDefined) Then If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then If ((MM_rsCount Mod MM_size) > 0) Then MM_offset = MM_rsCount - (MM_rsCount Mod MM_size) Else MM_offset = MM_rsCount - MM_size End If End If End If If (MM_rs.CursorType > 0) Then MM_rs.MoveFirst
|