相關(guān)資訊
- 《戰(zhàn)國(guó)無雙4-2》怎么換服裝?戰(zhàn)國(guó)無
- 關(guān)于責(zé)任的名言警句大全
- 《戰(zhàn)國(guó)無雙4-2》PC版如何聯(lián)機(jī)? 戰(zhàn)
- 戰(zhàn)國(guó)無雙4-2技能覺醒牛逼嗎 全新
- 《戰(zhàn)國(guó)無雙4-2》手柄無效怎么解決
- 戰(zhàn)國(guó)無雙4-2如何設(shè)置語言 戰(zhàn)國(guó)無雙
- 戰(zhàn)國(guó)無雙4-2怎么樣跳過進(jìn)入開場(chǎng)動(dòng)畫
- 什么是應(yīng)屆生畢業(yè)生
- 應(yīng)屆生簡(jiǎn)歷自我評(píng)價(jià)
- 應(yīng)屆生簡(jiǎn)歷怎么寫
本類常用軟件
-
福建農(nóng)村信用社手機(jī)銀行客戶端下載下載量:584204
-
Windows優(yōu)化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農(nóng)村信用社手機(jī)銀行客戶端下載下載量:365699
-
快播手機(jī)版下載量:325855
本文將提供一個(gè)ASP代碼實(shí)例給大家,是關(guān)于一個(gè)分頁的ASP代碼例子,希望對(duì)大家有用。
<%''本程序文件名為:Pages.ASP%>
<%''包含ADO常量表文件adoVBs.inc,可從"\Program Files\Common Files\System\ADO"目錄下拷貝%>
<!--#Include File="adovbs.inc"-->
<%''*建立數(shù)據(jù)庫連接,這里是Oracle8.05數(shù)據(jù)庫
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=msdaora.1;Data Source=YourSrcName;User ID=YourUserID;Password=YourPassword;"
Set rs=Server.CreateObject("ADODB.Recordset") ''創(chuàng)建Recordset對(duì)象
rs.CursorLocation=adUseClient ''設(shè)定記錄集指針屬性
''*設(shè)定一頁內(nèi)的記錄總數(shù),可根據(jù)需要進(jìn)行調(diào)整
rs.PageSize=10
''*設(shè)置查詢語句
StrSQL="Select ID,姓名,住址,電話 from 通訊錄 Order By ID"
rs.Open StrSQL,conn,adOpenStatic,adLockReadOnly,adCmdText
%>
<HTML>
<HEAD>
<title>分頁示例</title>
<script language=java script>
//點(diǎn)擊"[第一頁]"時(shí)響應(yīng):
function PageFirst()
{
document.MyForm.CurrentPage.selectedIndex=0;
document.MyForm.CurrentPage.onchange();
}
//點(diǎn)擊"[上一頁]"時(shí)響應(yīng):
function PagePrior()
{
document.MyForm.CurrentPage.selectedIndex--;
document.MyForm.CurrentPage.onchange();
}
//點(diǎn)擊"[下一頁]"時(shí)響應(yīng):
function PageNext()
{
document.MyForm.CurrentPage.selectedIndex++;
document.MyForm.CurrentPage.onchange();
}
//點(diǎn)擊"[最后一頁]"時(shí)響應(yīng):
function PageLast()
{
document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1;
document.MyForm.CurrentPage.onchange();
}
//選擇"第?頁"時(shí)響應(yīng):
function PageCurrent()
{ //Pages.asp是本程序的文件名
document.MyForm.action='Pages.asp?Page='+(document.MyForm.CurrentPage.selectedIndex+1)
document.MyForm.submit();
}
</Script>
</HEAD>
<BODY bgcolor="#ffffcc" link="#008000" vlink="#008000" alink="#FF0000"">
<%IF rs.Eof THEN
Response.Write("<font size=2 color=#000080>[數(shù)據(jù)庫中沒有記錄!]</font>")
ELSE
''指定當(dāng)前頁碼
If Request("CurrentPage")="" Then
rs.AbsolutePage=1
Else
rs.AbsolutePage=CLng(Request("CurrentPage"))
End If
''創(chuàng)建表單MyForm,方法為Get
Response.Write("<form method=Get name=MyForm>")
Response.Write("<p align=center><font size=2 color=#008000>")
''設(shè)置翻頁超鏈接
if rs.PageCount=1 then
Response.Write("[第一頁] [上一頁] [下一頁] [最后一頁] ")
else
if rs.AbsolutePage=1 then
Response.Write("[第一頁] [上一頁] ")
Response.Write("[<a href=java script:PageNext()>下一頁</a>] ")
Response.Write("[<a href=java script:PageLast()>最后一頁</a>] ")
else
if rs.AbsolutePage=rs.PageCount then
Response.Write("[<a href=java script:PageFirst()>第一頁</a>] ")
Response.Write("[<a href=java script:PagePrior()>上一頁</a>] ")
Response.Write("[下一頁] [最后一頁] ")
else
Response.Write("[<a href=java script:PageFirst()>第一頁</a>] ")
Response.Write("[<a href=java script:PagePrior()>上一頁</a>] ")
Response.Write("[<a href=java script:PageNext()>下一頁</a>] ")
Response.Write("[<a href=java script:PageLast()>最后一頁</a>] ")
end if
end if
end if
''創(chuàng)建下拉列表框,用于選擇瀏覽頁碼
Response.Write("第<select size=1 name=CurrentPage onchange=PageCurrent()>")
For i=1 to rs.PageCount
if rs.AbsolutePage=i then
Response.Write("<option selected>"&i&"</option>") ''當(dāng)前頁碼
else
Response.Write("<option>"&i&"</option>")
end if
Next
Response.Write("</select>頁/共"&rs.PageCount&"頁 共"&rs.RecordCount&"條記錄</font><p>")
Response.Write("</form>")
''創(chuàng)建表格,用于顯示
Response.Write("<table align=center cellspacing=1 cellpadding=1 border=1")
Response.Write(" bordercolor=#99CCFF bordercolordark=#b0e0e6 bordercolorlight=#000066>")
Response.Write("<tr bgcolor=#ccccff bordercolor=#000066>")
Set Columns=rs.Fields
''顯示表頭
For i=0 to Columns.Count-1
Response.Write("<td align=center width=200 height=13>")
Response.Write("<font size=2><b>"&Columns(i).name&"</b></font></td>")
Next
Response.Write("</tr>")
''顯示內(nèi)容
For i=1 to rs.PageSize
Response.Write("<tr bgcolor=#99ccff bordercolor=#000066>")
For j=0 to Columns.Count-1
Response.Write("<td><font size=2>"&Columns(j)&"</font></td>")
Next
Response.Write("</tr>")
rs.movenext
if rs.EOF then exit for
Next
Response.Write("</table>")
END IF
%>
</BODY>
</HTML>