最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp 分页实现代码
时间:2022-06-29 14:23:16 编辑:袖梨 来源:一聚教程网
提供一款比较完整的asp教程分页函数,这款分页类可以实现上一页,下一页,等功能。
'仅供参考,你可以任意修改、传播;如果你对它进行了改良,希望你能给我一个
'副本,谢谢。
'--------------------------------------------------------------------
class turnpage
dim spageno,spagesize,spagecount,srecordcount,sabsoluterecord
private sub class_initialize()
spageno=trim(request.querystring("pageno"))
if spageno<>"" then
spageno = cdbl(spageno)
else
spageno = 1
end if
sabsoluterecord = 1
end subpublic sub getrs(byref conn,byref rs,byval sql,byval pagesize)
rs.open sql,conn,1,1
rs.pagesize = pagesize
spagesize = rs.pagesize
spagecount = rs.pagecount
srecordcount = rs.recordcount
if not rs.eof then rs.absolutepage = spageno
end sub
public function eof()
if sabsoluterecord<=spagesize then
'sabsoluterecord = sabsoluterecord + 1
eof = false
else
eof = true
end if
end function
public sub movenext()
sabsoluterecord = sabsoluterecord + 1
end sub
public sub getpagelist()
if spagecount<=1 then exit sub
dim surl,stmp,squery_string,p,n,i,a,b
surl = request.servervariables("url")
squery_string = request.servervariables("query_string")
stmp = split(surl,"/")
surl = stmp(ubound(stmp))
if squery_string <> "" then squery_string=replace(squery_string,"pageno=" & spageno,"")
if squery_string = "" then
surl = surl & "?"
else
surl = surl & "?" & squery_string & "&"
end if
surl = replace(surl,"&&","&")
p = spageno-1
n = spageno+1
if p<1 then p = 1
if n>spagecount then n = spagecount
a = spageno-5
b = spageno+5
if a<1 then a = 1
if b>spagecount then b = spagecount
response.write("")")
if spageno>1 then response.write("首页 上页")
for i=a to b
response.write(" if i = spageno then response.write(" style=""font-weight:bold; color:#ff0000;""")
response.write(">" & i & "")
next
if spageno < spagecount then response.write(" 下页 末页")response.write("
end sub
public sub getpagehtmllist(baseurl)
if spagecount<=1 then exit sub
dim p,n,i,a,b
p = spageno-1
n = spageno+1
if p<1 then p = 1
if n>spagecount then n = spagecount
a = spageno-5
b = spageno+5
if a<1 then a = 1
if b>spagecount then b = spagecount
response.write("")")
if spageno>1 then response.write("首页 上页")
for i=a to b
response.write(" if i = spageno then response.write(" style=""font-weight:bold; color:#ff0000;""")
response.write(">" & i & "")
next
if spageno < spagecount then response.write(" 下页 末页")
response.write("
end sub
end class
相关文章
- 逆水寒手游橙戒流火幻荧什么时候上线 04-25
- 原神仆人阵容搭配推荐 04-25
- 恶意不息铁匠铺怎么升级 04-25
- 原神龙蜥特急斯库拉号成就怎么达成 04-25
- 恶意不息浅滩双子掉落什么 04-25
- 原神仆人阿蕾奇诺武器推荐 04-25