亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

dreamweaverMX通用分頁代碼研究

2019-11-18 20:16:03
字體:
來源:轉載
供稿:網友
DreamweaverMX已經正式發布了,Deamweaver4 + Deamweaver ULTRADEV 4 的組合使他成為當然的制做網頁的首選工具,(好象做廣告:) )
好了,進入正題,
我在以前做網頁的分頁時候都是用自己寫的服務端腳本(我從不用ADO的分頁),用了MX后發現在這里面用分頁太方便了,不過代碼也有點太長了,大家看下面的代碼就可以知道。用過之后我發現里面recordset 的cursortype設為0分頁竟然可以正常工作!這令我吃驚不少,分析了代碼之后才發現MX 是用了一種挺笨的方法實現的,效率很低,所以大家還是用1吧:)
分析如下:


<%@LANGUAGE="VBSCRipT" CODEPAGE="936"%>
<!--#include file="Connections/ncarcnn.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_ncarcnn_STRING
Recordset1.Source = "SELECT * FROM dbo.ncarinfo"

Recordset1.CursorType = 0
'這里用0也可以正常運行,但是經過分析代碼可以看出,用0的效率很低,建議用1


Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>


<%
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'以下為分頁代碼
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
'  *** Recordset狀態, 定義狀態變量

Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last

' set the record count
Recordset1_total = Recordset1.RecordCount

' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
  Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
  Recordset1_numRows = 1
End If

' set the first and last displayed record
Recordset1_first = 1
Recordset1_last  = Recordset1_first + Recordset1_numRows - 1

' if we have the correct record count, check the other stats 處理正確的rs
If (Recordset1_total <> -1) Then
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If
  If (Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them處理錯誤的RS

If (Recordset1_total = -1) Then

  ' count the total records by iterating through the recordset
  Recordset1_total=0
  While (Not Recordset1.EOF)
    Recordset1_total = Recordset1_total + 1
    Recordset1.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (Recordset1.CursorType > 0) Then
    Recordset1.MoveFirst
  Else
    Recordset1.Requery
  End If

  ' set the number of rows displayed on this page
  If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If

  ' set the first and last displayed record
  Recordset1_first = 1
  Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If

End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables

Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined

Dim MM_param
Dim MM_index

Set MM_rs    = Recordset1
MM_rsCount   = Recordset1_total
MM_size      = Recordset1_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
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  MM_param = Request.QueryString("index")
  If (MM_param = "") Then
    MM_param = Request.QueryString("offset")
  End If
  If (MM_param <> "") Then
    MM_offset = Int(MM_param)
  End If

  ' if we have a record count, check if we are past the end of the recordset
  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

  ' move the cursor to the selected record
  MM_index = 0
  While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
  If (MM_rs.EOF) Then
    MM_offset = MM_index  ' set MM_offset to the last possible record
  End If

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  MM_index = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = MM_index
    If (MM_size < 0 Or MM_size > MM_rsCount) Then
      MM_size = MM_rsCount
    End If
  End If

  ' if we walked off the end, set the offset based on page size
  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

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  MM_index = 0
  While (Not MM_rs.EOF And MM_index < MM_offset)
    MM_rs.MoveNext
    MM_index = MM_index + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
Recordset1_first = MM_offset + 1
Recordset1_last  = MM_offset + MM_size

If (MM_rsCount <> -1) Then
  If (Recordset1_first > MM_rsCount) Then
    Recordset1_first = MM_rsCount
  End If
  If (Recordset1_last > MM_rsCount) Then
    Recordset1_last = MM_rsCount
  End If
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and PRevious links

Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev

Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    MM_paramList = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For MM_paramIndex = 0 To UBound(MM_paramList)
      MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
      If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then
  MM_keepMove = MM_keepMove & "&"
End If

MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="

MM_moveFirst = MM_urlStr & "0"
MM_moveLast  = MM_urlStr & "-1"
MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
  MM_movePrev = MM_urlStr & "0"
Else
  MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<p></p>

<table border="1">
  <tr>
    <td>cpno</td>
    <td>cbno</td>
    <td>cdpt</td>
    <td>cid</td>
    <td>cbnm</td>
    <td>ddate</td>
    <td>cstate</td>
    <td>guid</td>
  </tr>
  <% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
  <tr>
    <td><%=(Recordset1.Fields.Item("cpno").Value)%></td>
    <td><%=(Recordset1.Fields.Item("cbno").Value)%></td>
    <td><%=(Recordset1.Fields.Item("cdpt").Value)%></td>
    <td><%=(Recordset1.Fields.Item("cid").Value)%></td>
    <td><%=(Recordset1.Fields.Item("cbnm").Value)%></td>
    <td><%=(Recordset1.Fields.Item("ddate").Value)%></td>
    <td><%=(Recordset1.Fields.Item("cstate").Value)%></td>
    <td><%=(Recordset1.Fields.Item("guid").Value)%></td>
  </tr>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
  
</table>
<p>&nbsp;</p>
<table border="0" width="50%" align="center">
  <tr>
    <td width="23%" align="center"> <% If MM_offset <> 0 Then %>
      <a href="<%=MM_moveFirst%>"><img src="First.gif" border=0></a>
      <% End If ' end MM_offset <> 0 %> </td>
    <td width="31%" align="center"> <% If MM_offset <> 0 Then %>
      <a href="<%=MM_movePrev%>"><img src="Previous.gif" border=0></a>
      <% End If ' end MM_offset <> 0 %> </td>
    <td width="23%" align="center"> <% If Not MM_atTotal Then %>
      <a href="<%=MM_moveNext%>"><img src="Next.gif" border=0></a>
      <% End If ' end Not MM_atTotal %> </td>
    <td width="23%" align="center"> <% If Not MM_atTotal Then %>
      <a href="<%=MM_moveLast%>"><img src="Last.gif" border=0></a>
      <% End If ' end Not MM_atTotal %> </td>
  </tr>
</table>

Records <%=(Recordset1_first)%> to <%=(Recordset1_last)%> of <%=(Recordset1_total)%>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>



編譯成dll用也可以:)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲伊人一本大道中文字幕| 久久久久久久久久久久av| 2019中文字幕全在线观看| 欧美激情区在线播放| 亚洲理论在线a中文字幕| 一区二区日韩精品| 欧美第一黄网免费网站| 日韩色av导航| 欧美做爰性生交视频| 精品香蕉一区二区三区| 亚洲精品乱码久久久久久按摩观| 国产精品jvid在线观看蜜臀| 92看片淫黄大片看国产片| 亚洲一区二区三区视频播放| 久久免费国产精品1| 欧美丰满老妇厨房牲生活| 日韩在线视频免费观看高清中文| 亚洲国内高清视频| 中文字幕在线亚洲| 国内揄拍国内精品少妇国语| 国产成人精品电影| 亚洲一区二区三区香蕉| 亚洲最大的成人网| 亚洲国产精品高清久久久| 欧美成人在线免费| 国产香蕉97碰碰久久人人| 欧美日韩国产一中文字不卡| 国产美女精品视频免费观看| 色综合伊人色综合网| 亚洲开心激情网| 久久久久久久av| 国产精品www网站| 亚洲色图18p| 国产激情久久久久| 国产日韩在线亚洲字幕中文| 91久热免费在线视频| 亚洲性生活视频| 色爱av美腿丝袜综合粉嫩av| 国产一区二区三区视频在线观看| 亚洲成人黄色在线观看| 美女久久久久久久| 少妇高潮 亚洲精品| 国产成人精品在线播放| 亚洲网站在线播放| 色阁综合伊人av| 日韩精品视频免费在线观看| 国产成人综合亚洲| 久久久亚洲精选| 亚洲电影免费观看高清| 国产成人在线视频| 波霸ol色综合久久| 日韩在线视频二区| 91精品视频免费看| 麻豆精品精华液| 欧美一区二区三区艳史| 在线观看久久av| 美日韩精品免费观看视频| 成人h猎奇视频网站| 色琪琪综合男人的天堂aⅴ视频| 国产精品18久久久久久首页狼| 久久香蕉国产线看观看av| 成人精品aaaa网站| 日韩中文字幕av| 久久视频在线免费观看| 少妇高潮久久77777| 国产一区二区三区在线| 免费91麻豆精品国产自产在线观看| 亚洲色图激情小说| 国产综合久久久久久| 国产精品高潮粉嫩av| 亚洲一区二区三区在线免费观看| 日产日韩在线亚洲欧美| 国产精品吹潮在线观看| 久久久久久久久中文字幕| 中文字幕日韩精品有码视频| 91豆花精品一区| 91av在线国产| 亚洲欧美制服综合另类| 丝袜美腿亚洲一区二区| 久久精彩免费视频| 欧美黑人视频一区| 91在线无精精品一区二区| 欧美日韩亚洲激情| 欧美视频一区二区三区…| 亚洲精品永久免费精品| 欧美麻豆久久久久久中文| 欧美一级片久久久久久久| 欧美尤物巨大精品爽| 国产69精品99久久久久久宅男| 色综合久久88| 日本精品一区二区三区在线| 欧美中文在线免费| 国产成人久久久精品一区| 伊人久久久久久久久久久| 日韩精品在线观看一区| 亚洲精品美女久久久| 成人网在线免费观看| 成人福利网站在线观看| 久久这里有精品视频| 国产精品欧美日韩一区二区| 亚洲视频一区二区三区| 国产欧美一区二区三区在线看| 欧美激情第三页| 国产网站欧美日韩免费精品在线观看| 亚洲成人网av| 欧美成人黄色小视频| 97在线看福利| xxxx欧美18另类的高清| 亚洲成**性毛茸茸| 国产大片精品免费永久看nba| 欧美极品少妇全裸体| 欧美日韩成人在线视频| 久久久国产成人精品| 国产精品欧美一区二区| 欧美精品videosex牲欧美| 久热爱精品视频线路一| 久久久久久免费精品| 亚洲精品短视频| 91九色视频在线| 国产亚洲精品91在线| 日本欧美在线视频| 91精品国产99久久久久久| 亚洲免费视频观看| 中文字幕在线精品| 日韩专区中文字幕| 热99在线视频| 亚洲加勒比久久88色综合| 色综合久久精品亚洲国产| 国产成人在线一区二区| 韩剧1988在线观看免费完整版| 久久精品视频99| 亚洲va国产va天堂va久久| 国产精品一区av| 黄网动漫久久久| 亚洲第一精品福利| 日本亚洲欧美成人| 国产性猛交xxxx免费看久久| 精品国产老师黑色丝袜高跟鞋| 狠狠躁夜夜躁人人爽超碰91| 2019中文字幕全在线观看| 日韩精品免费在线视频观看| 欧美性xxxx在线播放| 日韩黄在线观看| 九色精品美女在线| 久久av资源网站| 色视频www在线播放国产成人| 日韩欧美在线视频观看| 欧洲中文字幕国产精品| 久久精品久久久久久| 国产精品美乳一区二区免费| 久久久久久久久久久人体| 日韩av在线免费观看| 69久久夜色精品国产69| 欧美日韩国产精品一区二区不卡中文| 亚洲xxx大片| 日韩国产欧美精品在线| 亚洲欧美变态国产另类| 色偷偷91综合久久噜噜| 日韩a**站在线观看| 久久精品国产成人| xxxxx成人.com| www日韩中文字幕在线看| 国产在线观看91精品一区| 欧美午夜视频一区二区|