佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > 分頁(yè)代碼

分頁(yè)代碼

熱門標(biāo)簽:服務(wù)器配置 科大訊飛語(yǔ)音識(shí)別系統(tǒng) 阿里云 Mysql連接數(shù)設(shè)置 電子圍欄 銀行業(yè)務(wù) 團(tuán)購(gòu)網(wǎng)站 Linux服務(wù)器
 

分頁(yè)代碼:
%''本程序文件名為:Pages.asp%>
%''包含ADO常量表文件adovbs.inc,可從"\Program Files\Common Files\System\ADO"目錄下拷貝%>
!--#Include File="adovbs.inc"-->
%''*建立數(shù)據(jù)庫(kù)連接,這里是Oracle8.05數(shù)據(jù)庫(kù)
 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è)定一頁(yè)內(nèi)的記錄總數(shù),可根據(jù)需要進(jìn)行調(diào)整 
 rs.PageSize=10                   
 
 ''*設(shè)置查詢語(yǔ)句   
 StrSQL="Select ID,姓名,住址,電話 from 通訊錄 Order By ID"    
 rs.Open StrSQL,conn,adOpenStatic,adLockReadOnly,adCmdText
%>
HTML>
HEAD>
title>分頁(yè)示例/title>
script language=javascript>
 //點(diǎn)擊"[第一頁(yè)]"時(shí)響應(yīng):
 function PageFirst()
 { 
  document.MyForm.CurrentPage.selectedIndex=0;
  document.MyForm.CurrentPage.onchange();
 }
 //點(diǎn)擊"[上一頁(yè)]"時(shí)響應(yīng):
 function PagePrior()
 {  
  document.MyForm.CurrentPage.selectedIndex--;
  document.MyForm.CurrentPage.onchange();
 }
 //點(diǎn)擊"[下一頁(yè)]"時(shí)響應(yīng):
 function PageNext()
 { 
  document.MyForm.CurrentPage.selectedIndex++;
  document.MyForm.CurrentPage.onchange();     
 }
 //點(diǎn)擊"[最后一頁(yè)]"時(shí)響應(yīng):
 function PageLast()
 { 
  document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1;
  document.MyForm.CurrentPage.onchange();
 }
 //選擇"第?頁(yè)"時(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ù)庫(kù)中沒有記錄!]/font>")
 ELSE 
  ''指定當(dāng)前頁(yè)碼
  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è)置翻頁(yè)超鏈接
  if rs.PageCount=1 then 
   Response.Write("[第一頁(yè)] [上一頁(yè)] [下一頁(yè)] [最后一頁(yè)] ")
  else 
    if rs.AbsolutePage=1 then
     Response.Write("[第一頁(yè)] [上一頁(yè)] ")
     Response.Write("[a href=javascript:PageNext()>下一頁(yè)/a>] ") 
     Response.Write("[a href=javascript:PageLast()>最后一頁(yè)/a>] ") 
    else 
      if rs.AbsolutePage=rs.PageCount then
       Response.Write("[a href=javascript:PageFirst()>第一頁(yè)/a>] ") 
       Response.Write("[a href=javascript:PagePrior()>上一頁(yè)/a>] ") 
       Response.Write("[下一頁(yè)] [最后一頁(yè)] ")
      else
        Response.Write("[a href=javascript:PageFirst()>第一頁(yè)/a>] ") 
        Response.Write("[a href=javascript:PagePrior()>上一頁(yè)/a>] ") 
        Response.Write("[a href=javascript:PageNext()>下一頁(yè)/a>] ") 
        Response.Write("[a href=javascript:PageLast()>最后一頁(yè)/a>] ") 
      end if
    end if
  end if
  
  ''創(chuàng)建下拉列表框,用于選擇瀏覽頁(yè)碼
  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)前頁(yè)碼
   else
    Response.Write("option>"i"/option>")
   end if 
  Next 
  Response.Write("/select>頁(yè)/共"rs.PageCount"頁(yè) 共"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>

標(biāo)簽:大理 衡水 棗莊 蚌埠 廣元 江蘇 萍鄉(xiāng) 衢州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《分頁(yè)代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    白城市| 城步| 柘城县| 镇康县| 太白县| 峡江县| 门头沟区| 密云县| 鲁山县| 郎溪县| 巴塘县| 宽甸| 克山县| 永丰县| 花垣县| 江口县| 波密县| 西青区| 金华市| 日照市| 公安县| 安达市| 溧阳市| 通化县| 长岭县| 佳木斯市| 饶阳县| 建平县| 久治县| 崇阳县| 固阳县| 改则县| 涟源市| 全椒县| 当雄县| 辽阳市| 沁阳市| 富民县| 伊宁市| 容城县| 宜兴市|