濮阳杆衣贸易有限公司

主頁 > 知識庫 > 我用ASP寫的m行n列的函數(shù),動態(tài)輸出創(chuàng)建TABLE行列

我用ASP寫的m行n列的函數(shù),動態(tài)輸出創(chuàng)建TABLE行列

熱門標(biāo)簽:虛擬電話外呼系統(tǒng) 長春公司外呼系統(tǒng)中心 鄭州智能外呼電銷機器人廠家 廣東語音外呼系統(tǒng)公司 鄢陵學(xué)校如何做地圖標(biāo)注 云南便宜外呼系統(tǒng)平臺 沈陽三五防封電銷卡 成都ai外呼系統(tǒng)線路 沈陽電話機器人公司
沒有用正常的循環(huán)tr內(nèi)循環(huán)td的方法,所以就沒有計算最后一頁的記錄集數(shù)量。
但當(dāng)記錄集不足時也同樣能夠自動補空行空列,如有不足請指出,謝謝。
使用方法很簡單:

復(fù)制代碼 代碼如下:


showData("查詢語名") 
Call pagehead(行數(shù),列數(shù)) 
'------------------------------------------------------------------------------- 
'可以把下面的Response.Write()寫到函數(shù)里面,看個人的愛好了。 
Response.Write(FormatCRtable(表格寬度,表格高度)) 
Response.Write(PageFoot()) 
Call closeData() 
%> 

函數(shù)如下: 

 

復(fù)制代碼 代碼如下:


'------------------------------------------------------------------------------- 
'Copyright 2005 by Jorkin.All Rights Reserved 
'------------------------------------------------------------------------------- 
Public rs 
Public pageno,Cols,Rows,maxpageno,maxredcount,maxpagesize 
'------------------------------------------------------------------------------- 
Public Function showData(sqlstrings) 
  Set rs=Server.CreateObject("ADODB.Recordset") 
  rs.open sqlstrings,oconn,1,3 
End Function 
Public Function closeData() 
  rs.close 
  Set rs=Nothing 
End Function 
'初始化分頁 
'MaxRows =最大行數(shù) 
'MaxCols =最大列數(shù) 
'------------------------------------------------------------------------------- 
Public Function PageHead(MaxRows,MaxCols) 
'------------------------------------------------------------------------------- 
  Rows=MaxRows 
  Cols=MaxCols 
  maxpagesize=1 
  maxredcount=0 
  maxpageno=0 
  pageno=0 
'------------------------------------------------------------------------------- 
  maxredcount = rs.recordcount 
  If maxredcount>0 then 
  maxpagesize = Rows*Cols 
  maxpageno = Cint((maxredcount+maxpagesize-1)/maxpagesize) 
  rs.pagesize = maxpagesize 
  pageno=Request("pageno") 
  If IsEmpty(pageno) Or Not IsNumeric(pageno) Or CInt(pageno)1 Or CInt(pageno)>Rs.Pagecount Then 
   Pageno=1 
  End If 
  rs.absolutePage=pageno 
  End If 
  On Error Resume Next 
End Function 
'分頁函數(shù)尾 
'無參數(shù) 
'------------------------------------------------------------------------------- 
Public Function PageFoot() 
  strr="table width=""500"" border=""0"" cellpadding=""0"" cellspacing=""0"">"  VbCrLf 
  strr=strr"  tr>"  VbCrLf 
  strr=strr"    td valign=""top"">div align=""Right"">" 
'大于1頁才會顯示首頁和上一頁(可選) 
' If pageno>1 Then 
   strr=strr"a href=""?pageno=1"" title=""首頁"">font face = Webdings>9/font>/a>" 
   strr=strr" " 
   strr=strr"a href=""?pageno="pageno-1""" title=""上一頁"">font face = Webdings>7/font>/a>" 
' End If 
  strr=strr" "pageno" " 
'小于最大頁數(shù)才會顯示下一頁和尾頁(可選) 
' If pagenomaxpageno Then 
   strr=strr"a href=""?pageno="pageno+1""" title=""下一頁"">font face = Webdings>8/font>/a>" 
   strr=strr" " 
   strr=strr"a href=""?pageno="maxpageno""" title="""">font face = Webdings>:/font>/a>" 
' End If 
  strr=strr"    " 
  strr=strr(pageno-1)*maxpagesize+1"/"maxredcount"條記錄" 
  strr=strr"    " 
  strr=strrpageno"/"maxpageno"頁" 
  strr=strr"/div>/td>"  VbCrLf 
  strr=strr"  /tr>"  vbCrLf 
  strr=strr"/table>" 
  PageFoot=strr 
End Function 
'進行行列格式化函數(shù) 
'TableWidth  =表格寬度 
'TableHeight =表格高度(因瀏覽器不同可能無效) 
'------------------------------------------------------------------------------- 
Public Function FormatCRtable(TableWidth,TableHeight) 
  Dim i,strr 
  i=0 
  strr="" 
  strr=strr"table width="""TableWidth"""  border=""0"" cellspacing=""0"" cellpadding=""0"">"  vbCrLf 
  strr=strr"  tr>"  VbCrLf 
  If maxredcount>0 Then 
   Do While imaxpagesize 
    i=i+1 
    If Not Rs.eof Then 
     strr=strr"    td width="""TableWidth/Cols""" height="""Tableheight/Rows""">有記錄則進行輸出/td>"  vbCrLf 
     Rs.movenext 
    Else 
     strr=strr"    td width="""TableWidth/Cols""" height="""Tableheight/Rows""">記錄集不足時補余/td>"  VbCrLf 
    End If 
    If i Mod Cols = 0 Then 
     strr=strr"  /tr>"  VbCrLf 
     strr=strr"  tr>"  vbCrLf 
    End If 
   Loop 
  Else 
   strr=strr"td height="""TableWidth""" valign=""top"">目前沒有記錄集/td>" 
  End if 
  strr=strr"  /tr>"  VbCrLf 
  strr=strr"/table>"  VbCrLf 
  FormatCRtable=strr 
End Function 
%> 
代碼還有很多不足,而且寫的也不是很嚴(yán)謹,見笑了。
以后可以會改為Class
轉(zhuǎn)自:http://jorkin.reallydo.com/article.asp?id=15

標(biāo)簽:孝感 平頂山 四平 遼陽 湖北 朝陽 馬鞍山 防城港

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《我用ASP寫的m行n列的函數(shù),動態(tài)輸出創(chuàng)建TABLE行列》,本文關(guān)鍵詞  我用,ASP,寫的,行,列,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《我用ASP寫的m行n列的函數(shù),動態(tài)輸出創(chuàng)建TABLE行列》相關(guān)的同類信息!
  • 本頁收集關(guān)于我用ASP寫的m行n列的函數(shù),動態(tài)輸出創(chuàng)建TABLE行列的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    孝昌县| 兴仁县| 武穴市| 隆尧县| 盘山县| 信丰县| 台南县| 施甸县| 三台县| 林口县| 镇原县| 交口县| 方城县| 金沙县| 时尚| 淅川县| 肥城市| 新野县| 宁远县| 凉山| 田林县| 云林县| 洛阳市| 板桥市| 扎鲁特旗| 乐山市| 丹江口市| 微博| 青冈县| 广灵县| 和田市| 仁布县| 双峰县| 南部县| 易门县| 墨竹工卡县| 开阳县| 巴林左旗| 江阴市| 寿宁县| 姜堰市|