无为清净楼资源网 Design By www.qnjia.com
没有用正常的循环tr内循环td的方法,所以就没有计算最后一页的记录集数量。
但当记录集不足时也同样能够自动补空行空列,如有不足请指出,谢谢。
使用方法很简单:
复制代码 代码如下:
<%
showData("查询语名")
Call pagehead(行数,列数)
'-------------------------------------------------------------------------------
'可以把下面的Response.Write()写到函数里面,看个人的爱好了。
Response.Write(FormatCRtable(表格宽度,表格高度))
Response.Write(PageFoot())
Call closeData()
%>
函数如下:
复制代码 代码如下:
<%
'-------------------------------------------------------------------------------
'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 =最大行数
'MaxCols =最大列数
'-------------------------------------------------------------------------------
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
'分页函数尾
'无参数
'-------------------------------------------------------------------------------
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&" "
'小于最大页数才会显示下一页和尾页(可选)
' If pageno<maxpageno 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=strr&pageno&"/"&maxpageno&"页"
strr=strr&"</div></td>" & VbCrLf
strr=strr&" </tr>" & vbCrLf
strr=strr&"</table>"
PageFoot=strr
End Function
'进行行列格式化函数
'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 i<maxpagesize
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
%>
代码还有很多不足,而且写的也不是很严谨,见笑了。
以后可以会改为Class
转自:http://jorkin.reallydo.com/article.asp?id=15
但当记录集不足时也同样能够自动补空行空列,如有不足请指出,谢谢。
使用方法很简单:
复制代码 代码如下:
<%
showData("查询语名")
Call pagehead(行数,列数)
'-------------------------------------------------------------------------------
'可以把下面的Response.Write()写到函数里面,看个人的爱好了。
Response.Write(FormatCRtable(表格宽度,表格高度))
Response.Write(PageFoot())
Call closeData()
%>
函数如下:
复制代码 代码如下:
<%
'-------------------------------------------------------------------------------
'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 =最大行数
'MaxCols =最大列数
'-------------------------------------------------------------------------------
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
'分页函数尾
'无参数
'-------------------------------------------------------------------------------
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&" "
'小于最大页数才会显示下一页和尾页(可选)
' If pageno<maxpageno 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=strr&pageno&"/"&maxpageno&"页"
strr=strr&"</div></td>" & VbCrLf
strr=strr&" </tr>" & vbCrLf
strr=strr&"</table>"
PageFoot=strr
End Function
'进行行列格式化函数
'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 i<maxpagesize
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
%>
代码还有很多不足,而且写的也不是很严谨,见笑了。
以后可以会改为Class
转自:http://jorkin.reallydo.com/article.asp?id=15
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月20日
2024年09月20日
- [电影原声带]黎允文《天将雄师》[FLAC+CUE]
- 曝NS继任机型已进入量产阶段:已花了30亿日元
- 不是Switch2?曝《马里奥惊奇》NS捆绑包即将公开
- 暖心任天堂!网友Switch维修返还时贴纸被完好保留
- 《国语老歌 经典对唱情歌 2CD》[WAV/分轨][1.1GB]
- 《刀郎 翻唱精选华语专辑 披着羊皮的狼 》[WAV+CUE][430MB]
- 《真的田震 中国乐坛红极一时的歌者 精品集》[WAV+CUE][300MB]
- 群星.1995-新滚石九大天王之情歌大全【滚石】【WAV+CUE】
- 群星.1993-滚石九大天王十二出好戏·纵夏欢唱【滚石】【WAV+CUE】
- 群星.1993-滚石九大天王十二出好戏·贺岁齐唱【滚石】【WAV+CUE】
- 黑神话悟空上品虫校尉精魄获取方法一览|上品虫校尉精魄收集攻略
- 《指环王:夏尔的传说》推迟至2025年初发行
- 黑神话悟空上品蝎太子精魄获取方法一览|上品蝎太子精魄收集攻略
- 银霞.1977-《台北66电影原声带》台湾复刻版[WAV+CUE]
- 银霞.1980-《你那好冷的小手》台湾珍藏纪念版[WAV+CUE]