欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2007年02月07日 00:00:00   作者:  
沒有用正常的循環(huán)tr內(nèi)循環(huán)td的方法,所以就沒有計(jì)算最后一頁(yè)的記錄集數(shù)量。
但當(dāng)記錄集不足時(shí)也同樣能夠自動(dòng)補(bǔ)空行空列,如有不足請(qǐng)指出,謝謝。
使用方法很簡(jiǎn)單:

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

<% 
showData("查詢語(yǔ)名") 
Call pagehead(行數(shù),列數(shù)) 
'------------------------------------------------------------------------------- 
'可以把下面的Response.Write()寫到函數(shù)里面,看個(gè)人的愛好了。 
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 
'初始化分頁(yè) 
'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 
'分頁(yè)函數(shù)尾 
'無(wú)參數(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頁(yè)才會(huì)顯示首頁(yè)和上一頁(yè)(可選) 
' If pageno>1 Then 
   strr=strr&"<a href=""?pageno=1"" title=""首頁(yè)""><font face = Webdings>9</font></a>" 
   strr=strr&" " 
   strr=strr&"<a href=""?pageno="&pageno-1&""" title=""上一頁(yè)""><font face = Webdings>7</font></a>" 
' End If 
  strr=strr&" "&pageno&" " 
'小于最大頁(yè)數(shù)才會(huì)顯示下一頁(yè)和尾頁(yè)(可選) 
' If pageno<maxpageno Then 
   strr=strr&"<a href=""?pageno="&pageno+1&""" title=""下一頁(yè)""><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=strr&pageno&"/"&maxpageno&"頁(yè)" 
  strr=strr&"</div></td>" & VbCrLf 
  strr=strr&"  </tr>" & vbCrLf 
  strr=strr&"</table>" 
  PageFoot=strr 
End Function 
'進(jìn)行行列格式化函數(shù) 
'TableWidth  =表格寬度 
'TableHeight =表格高度(因?yàn)g覽器不同可能無(wú)效) 
'------------------------------------------------------------------------------- 
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 i<maxpagesize 
    i=i+1 
    If Not Rs.eof Then 
     strr=strr&"    <td width="""&TableWidth/Cols&""" height="""&Tableheight/Rows&""">有記錄則進(jìn)行輸出</td>" & vbCrLf 
     Rs.movenext 
    Else 
     strr=strr&"    <td width="""&TableWidth/Cols&""" height="""&Tableheight/Rows&""">記錄集不足時(shí)補(bǔ)余</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)謹(jǐn),見笑了。
以后可以會(huì)改為Class
轉(zhuǎn)自:http://jorkin.reallydo.com/article.asp?id=15

相關(guān)文章

最新評(píng)論