您现在的位置是:网站首页> 编程资料编程资料
asp最常用的分页函数_应用技巧_
2023-05-25
234人已围观
简介 asp最常用的分页函数_应用技巧_
复制代码 代码如下:
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "
还没找到文章
"else
totalPut=rs.recordcount
maxperpage=18
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*maxperpage>totalput then
if (totalput mod maxperpage)=0 then
currentpage=totalput\maxperpage
else
currentpage=totalput\maxperpage+1
end if
end if
if currentpage=1 then
showpage1 totalput,maxperpage,"infotype.asp?id="&request("id")
showcontent()
showpage totalput,maxperpage,"infotype.asp?id="&request("id")
else
if (currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showpage1 totalput,maxperpage,"infotype.asp?id="&request("id")
showcontent
showpage totalput,maxperpage,"infotype.asp?id="&request("id")
else
currentpage=1
showpage1 totalput,maxperpage,"infotype.asp?id="&request("id")
showcontent
showpage totalput,maxperpage,"infotype.asp?id="&request("id")
end if
end if
end if
%>
<%
sub showcontent()
%>
ID
信息标题
更新日期
点击
添加人
编辑
删除
生成[归零]
<%
i=1
do while not rs.eof
%>
<%=rs("id")%>
">
strcounts=truelen(thetitle1)
response.write thetitle1
%>
<%
datetime=rs("datetime")
yname=year(datetime)
mname=month(datetime)
if len(mname)<2 then mname="0"&mname
dname=month(datetime)
if len(dname)<2 then dname="0"&dname
foldername=yname&mname
%>
<%=rs("hits")%>
<%=rs("author")%>
<%
i=i+1
if i>maxperpage then exit do
rs.movenext
loop
%>
ID
信息标题
更新日期
点击
添加人
编辑
删除
生成
<%
end sub
%>
<%
function showpage(totalnumber,maxperpage,filename)
%>
<%
dim n
if totalnumber mod maxperpage=0 then
n=totalnumber\maxperpage
else
n=totalnumber\maxperpage+1
end if
%>
共有<%=totalnumber%>/<%=maxperpage%>条,
当前页<%=currentpage%>/<%=n%>
<%if currentpage<2 then%>
[首页] [上一页]
<%else%>
">[首页] &page=<%=currentpage-1%>">[上一页]
<%end if%><% if n-currentpage<1 then%>
[下一页] [尾页]<%else%>&page=<%=currentpage+1%>">[下一页] &page=<%=n%>">[尾页]
<%end if%>
转到:
当前页<%=currentpage%>/<%=n%>
<%if currentpage<2 then%>
[首页] [上一页]
<%else%>
">[首页] &page=<%=currentpage-1%>">[上一页]
<%end if%><% if n-currentpage<1 then%>
[下一页] [尾页]<%else%>&page=<%=currentpage+1%>">[下一页] &page=<%=n%>">[尾页]
<%end if%>
转到:
<%
end function
%>
<%
function showpage1(totalnumber,maxperpage,filename)
%>
<%
dim b
if totalnumber mod maxperpage=0 then
b=totalnumber\maxperpage
else
b=totalnumber\maxperpage+1
end if
%>
共有<%=totalnumber%>/<%=maxperpage%>条,
当前页<%=currentpage%>/<%=b%>
<%
dxystart=currentpage-5
if dxystart<1 then dxystart=1
dxyend=currentpage+5
if dxyend>b then dxyend=b
for dxy=dxystart to dxyend
if dxy=currentpage then
response.write "["&""&dxy&""&"]"&" "
else
response.write "["&dxy&""&"]"&" "
end if
next
%>
当前页<%=currentpage%>/<%=b%>
<%
dxystart=currentpage-5
if dxystart<1 then dxystart=1
dxyend=currentpage+5
if dxyend>b then dxyend=b
for dxy=dxystart to dxyend
if dxy=currentpage then
response.write "["&""&dxy&""&"]"&" "
else
response.write "["&dxy&""&"]"&" "
end if
next
%>
<%
end function
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
