下拉菜单做翻页的通用代码
发布时间:2006-06-28 16:10:57 来源:天极网 网友评论 0 条还有最后一段是前后翻页的按钮,呵呵,这个还是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)
<%
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
If (MM_size > 0) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
params = Split(MM_keepMove, "&")
MM_keepMove = ""
For i = 0 To UBound(params)
nextItem = Left(params(i), InStr(params(i),"=") - 1)
If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & params(i)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
If (MM_keepMove <> "") Then MM_keepMove = MM_keepMove & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = urlStr & "0"
MM_moveLast = urlStr & "-1"
MM_moveNext = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev = urlStr & Cstr(prev)
%>
<script language="JavaScript">
function jumpage(selObj,restore){
eval("location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;}
</script>
<select name="pages" size=1 onChange="jumpage(this,0)" class="txtfld">
<%
TM_counter = 0
For i = 1 to 记录集名字_total Step MM_size
TM_counter = TM_counter + 1
TM_PageEndCount = i + MM_size - 1
if TM_PageEndCount > 记录集名字_total Then TM_PageEndCount = 记录集名字_total
if i <> MM_offset + 1 then
%>
<option value="<%=Request.ServerVariables("URL") & "?" & MM_keepMove & "offset=" & i-1 %>">
第 <%= TM_counter %> 页</option>
<% else %>
<option selected>第 <%=TM_counter%> 页</option>
<% End if %>
<% next %>
</select>
<input type="button" class="INPUT" onclick="location.href='<%=MM_movePrev%>'" value="|" style="FONT-FAMILY: 'Wingdings 3'" <% If MM_offset <> 0 Then
response.write ""
else
response.write "disabled"
end if %>>
<input type="button" class="INPUT" onclick="location.href='<%=MM_moveNext%>'" value="}" style="FONT-FAMILY: 'Wingdings 3'" <% If Not MM_atTotal Then
response.write ""
else
response.write "disabled"
end if %>>
- 推荐阅讯
- 小经验大作用 用CSS解决布局难题
- DIV+CSS布局实例:各种2栏3栏布局实例(附下载
- 实践DIV+CSS网页布局入门指南
- CSS技术在网页设计中的运用
- 网页对联式的图片广告代码
- 应用CSS样式表技巧两则
- 对CSS类及id的规范化命名
- 隐藏网页中的层DIV的技巧
- CSS hack浏览器兼容一览表
- 设计时如何把握网页布局
- 阅读排行
- 1.如何使用CSS来进行网页排版
- 2.CSS样式表教程-If you love css …
- 3.CSS用样式表美化你的网页
- 4.网页制作:几种所见所得的WEB在线编辑器
- 5.网页常见可用性错误——表单组件错误
- 6.CSS+JavaScript打造超酷右键菜单
- 7.针对浏览器隐藏CSS之九大技巧
- 8.DIV+CSS网页布局入门
- 9.搜索引擎的蜘蛛人(ROBOTS)秘密
- 10.CSS垂直树形下拉菜单
- 专题教程
- Windows Server-Windows Server文档-Windows Server新闻-Windows Ser PostgreSQL-PostgreSQL文档-PostgreSQL新闻-PostgreSQL专家
- WebLogic-WebLogic文档-WebLogic新闻-WebLogic专家 FreeBSD-FreeBSD文档-FreeBSD新闻-FreeBSD专家
- Linux-内核 GUI KDE Gnome DNS FTP 安全 安装-Linux专区 Windows-AD IIS ServerCore 虚拟化 安全 HPC-Windows专区
- 大话G游 专题:手机病毒揭密
- ARP攻击防范与解决方案 路由故障处理手册
