咨询:域名主机客服!261689845 建站:网站建设请点我!173022933 推广:网站推广请点我!452936608 销售:域名主机客服309128758 客户体验 | 售后平台 | 代理加盟 | 客户口碑

 

下拉菜单做翻页的通用代码 - 新闻中心 - 南宁巨人网络
下拉菜单做翻页的通用代码
时间:2013/3/9 14:12:03    来源:南宁巨人网络    浏览次数:791次
【字体大小:    】    【温馨提示:双击可滚动页面,单击则停止滚动。】

下拉菜单做翻页的通用代码

  这是一个用下拉菜单来做翻页的通用代码,我觉得这样做比较省空间,蛮好的

  其实这个代码就是老外的那个翻页插件,后来是哪位好朋友(不好意思,忘了)修改后放在论坛上的,我还做成过插件,其实光是拷贝也挺方便的。

  还有最后一段是前后翻页的按钮,呵呵,这个还是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)

  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

  Else

  MM_rs.Requery

  End If

  i = 0

  While (Not MM_rs.EOF And i < MM_offset)

  MM_rs.MoveNext

  i = i + 1

  Wend

  End If

  %>

  <%

  记录集名字_first = MM_offset + 1

  记录集名字_last = MM_offset + MM_size

  If (MM_rsCount <> -1) Then

  If (记录集名字_first > MM_rsCount) Then 记录集名字_first = MM_rsCount

  If (记录集名字_last > MM_rsCount) Then 记录集名字_last = MM_rsCount

  End If

  MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)

  %>

  <%

  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 %>>

        



关于我们 | 网站公告 | 参观机房 | 合作伙伴 | 代理合作 | 付款方式 | 法律声明 | 常见问题 | 在线留言 | 服务监督 | 联系我们 | 南宁网站建设
 
地址:广西南宁市广西大学正门左侧火炬路17号金达花园7栋2单元241室  邮编:530001  
业务邮箱:    技术邮箱:   财务邮箱:
在线服务空间域名:网站推广请点我!261689845 网站建设:网站建设请点我!309331800 网站推广:网站推广请点我!452936608 售后技术支持:网站推广请点我!309128758
代理合作:网站推广请点我!173022933 全国业务客服电话:0771-3824424  找巨人?  到巨人?
版权所有南宁市巨人网络 未经授权,禁止使用 中华人民共和国备案编号 :桂ICP备06014082号