%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html xmlns="http://www.w3.org/1999/xhtml">
head>
meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
title>asp分頁程序/title>
style type="text/css">
!--
.STYLE1 {font-size: 12px}
-->
/style>/head>
body>
p>
table width="186" height="39" border="1" cellpadding="0" cellspacing="0">
tr>
td>姓名/td>
td>密碼/td>
/tr>
%
set rs=server.createobject("adodb.recordset")
conn = "DBQ=" + server.mappath("zheng.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
sql="select * from user"
rs.open sql,conn,1,2
rs.pagesize=6 '設(shè)置頁面顯示得頁數(shù)
if request("page")>"" then
epage=cint(request("page"))
if epage1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
%>tr>
td>%=rs("name")%>/td>
td>%=rs("pass")%>/td>
/tr>
%
rs.movenext
next
%>
/table>
div align="left">span class="STYLE1">
form method="get" onsubmit=""document.location ="c.asp?Page='+ this.page.value;return false;'">
%if epage=1 then response.Write("首頁")else response.Write("a href='c.asp?page=1'>""首頁""/a>")%>
nbsp;
%if epage=1 then response.write("上一頁")else response.write"a href=c.asp?page="epage-1">上一頁/a>"%>
nbsp;
%if epage = rs.pagecount then response.write("下一頁")else response.write"a href=c.asp?page="epage+1">下一頁/a>"%>
nbsp;
%if epage = rs.pagecount then response.write("末頁")else response.write"a href=c.asp?page="rs.pagecount">末頁/a>"%>
nbsp;nbsp;現(xiàn)在是第font color="red">%=epage%>/font>頁一共有font color="red">%=rs.pagecount%>/font>頁
input name="page" value="%=epage%>" maxlength=5 tyep=text />
nbsp;頁
input type=submit value=GO style="font-size:12px;border:1px solid #CCCCCC;width:23px;" />/form>
/div>
p>nbsp;/p>
p>
%
name=request("name")
pass=request("pass")
if name>"" and pass>"" then
rs.Addnew
rs("name")=name
rs("pass")=pass
rs.update
rs.close
end if
%>
/p>
/p>
form id="form1" name="form1" method="post" action="">
p>
input name="name" type="text" id="name" />
/p>
p>
input name="pass" type="text" id="pass" />
input type="submit" name="Submit" value="提交" />
/p>
/form>
p>
table width="63%" border="0" cellpadding="0" cellspacing="1" bgcolor="#0000FF" style="border-collapse: collapse">
%
set mrs=server.createobject("adodb.recordset")
conn = "DBQ=" + server.mappath("zheng.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
sql="select * from user"
mrs.open sql,conn,1,1
If mRs.bof and mRs.eof then
Response.Write"span>沒有任何記錄/span>"
Response.End
Else
mRs.PageSize =6'每頁記錄條數(shù)
iCount=mRs.RecordCount '記錄總數(shù)
iPageSize=mRs.PageSize
maxpage=mRs.PageCount
page=request("page")
If Not IsNumeric(page) or page="" then
page=1
Else
page=cint(page)
End If
If page1 then
page=1
ElseIf page>maxpage then
page=maxpage
End If
mRs.AbsolutePage=Page
If page=maxpage then
x=iCount-(maxpage-1)*iPageSize
Else
x=iPageSize
End If
End If
for i=1 to mRs.pagesize
%>
tr>
td width="64%" bgcolor="#FFFFFF" class="STYLE1">%=mrs("name")%>/td>
td width="36%" bgcolor="#FFFFFF" class="STYLE1">%=mrs("pass")%>/td>
/tr>%
mRs.movenext
If mRs.eof then exit for
next
mRs.close
Set mRs=nothing
%>
tr>
td colspan="2" bgcolor="#CCCCCC">
span class="STYLE1">
%
call PageControl(iCount,maxpage,page)
Sub PageControl(iCount,pagecount,page)
'生成上一頁下一頁鏈接
Dim query, a, x, temp
action = "http://" Request.ServerVariables("HTTP_HOST") Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) > 0 Then
temp = temp a(0) "=" a(1) ""
End If
Next
Response.Write("table border='0' cellpadding='3' style='border-collapse: collapse' width='100%' align='center'>")
Response.Write("form method=get onsubmit=""document.location = '" action "?" temp "Page='+ this.page.value;return false;"">tr>")
Response.Write("td align='center' bgcolor='#FFFFFF'>")
If page=1 then
Response.Write ("首頁 " )
Response.Write ("上一頁 ")
Else
Response.Write("a href=" action "?" temp "Page=1>首頁/a> ")
Response.Write("a href=" action "?" temp "Page=" (Page-1) ">上一頁/a> ")
End If
If page>=pagecount then
Response.Write ("下一頁 ")
Response.Write ("尾頁 ")
Else
Response.Write("a href=" action "?" temp "Page=" (Page+1) ">下一頁/a> ")
Response.Write("a href=" action "?" temp "Page=" pagecount ">尾頁/a> ")
End If
Response.Write(" 頁次:" page "/" pageCount "nbsp;頁")
Response.Write(" 共有nbsp;" iCount "nbsp;條留言")
Response.Write(" 轉(zhuǎn)到nbsp;" "input tyep=text name=page maxlength=5 value=" page " style='font-size: 12px;border: 1px solid #CCCCCC;width:23px;'>" "nbsp;頁 input type=submit style=""font-size: 9pt"" value=GO style='font-size: 12px;border: 1px solid #CCCCCC;width:23px;'>")
Response.Write("/td>/tr>/form>")
Response.Write("/table>")
End Sub
%>
/span>/td>
/tr>
/table>
span class="STYLE1">
/p>
/form>
/body>
/html>
您可能感興趣的文章:- asp下計(jì)算分頁的幾種方法
- ASP分頁類(支持多風(fēng)格變換)
- 透徹掌握ASP分頁技術(shù)很詳細(xì)的分析
- 易心asp分頁類 v1.0
- asp分頁生成html的程序腳本代碼
- 徹底掌握ASP分頁技術(shù)雜談
- asp分頁的一個(gè)類
- 簡(jiǎn)單的ASP分頁代碼(測(cè)試正確)
- flash和asp分頁的一點(diǎn)心得與flash腳本
- js實(shí)現(xiàn)ASP分頁函數(shù) HTML分頁函數(shù)
- 葉子asp分頁類
- ASP分頁時(shí)計(jì)算頁面總數(shù)的幾種算法小結(jié)