在线建站培训
您的位置: 魔客吧 网络编程 ASP编程 查看内容

asp最常用的分页函数

2018-2-28 10:01 | 发布者: moke | 栏目:ASP编程












<%

i=1
do while not rs.eof
%>





<%
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
%>







<%
i=i+1
if i>maxperpage then exit do
rs.movenext
loop
%>











<%
end sub
%>




<%
function showpage(totalnumber,maxperpage,filename)
%>



<%
end function
%>
<%
function showpage1(totalnumber,maxperpage,filename)
%>



<%
end function
%>

复制代码 代码如下:

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=totalputmaxperpage
else
currentpage=totalputmaxperpage+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 rs.move (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
选择
信息标题
更新日期
点击
添加人
编辑
删除
生成[归零]
<%=rs("id")%>

">
" target="_blank">[<%=rs("type_id")%>]<%thetitle1=rs("title")
strcounts=truelen(thetitle1)
response.write thetitle1
%>
<%=foldername%>/<%=rs("id")%>.htm" title="查看生成的静态页面" target="_blank"><%=rs("datetime")%>
<%=rs("hits")%>
<%=rs("author")%>
">修改
)">删除
)">生成(','','width=0,height=0')"><%=rs("shengcheng")%>)
ID
选择
信息标题
更新日期
点击
添加人
编辑
删除
生成

<%
dim n
if totalnumber mod maxperpage=0 then
n=totalnumbermaxperpage
else
n=totalnumbermaxperpage+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%>
转到:

<%
dim b
if totalnumber mod maxperpage=0 then
b=totalnumbermaxperpage
else
b=totalnumbermaxperpage+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
%>

<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

魔客吧温馨提示:如果你想搭建商城或者电子商务网站,那么到魔客吧的 ecshop模板 频道看看吧,这里有很多的ecshop商城模板哦!

最新分享资源

最新评论

验证码 换一个