这里介绍一个asp常用的分页函数详细教程,方法很简单,感兴趣的朋友跟小编一起来了解一下吧!
复制代码 代码如下:
rs.opensql,conn,1,1
ifrs.eofandrs.bofthen
response.write"
"
else
totalPut=rs.recordcount
maxperpage=18
ifcurrentpage
currentpage=1
endif
if(currentpage-1)*maxperpage>totalputthen
if(totalputmodmaxperpage)=0then
currentpage=totalput/maxperpage
else
currentpage=totalput/maxperpage+1
endif
endif
ifcurrentpage=1then
showpage1totalput,maxperpage,"infotype.asp?id="&request("id")
showcontent()
showpagetotalput,maxperpage,"infotype.asp?id="&request("id")
else
if(currentpage-1)*maxperpage
rs.move(currentpage-1)*maxperpage
dimbookmark
bookmark=rs.bookmark
showpage1totalput,maxperpage,"infotype.asp?id="&request("id")
showcontent
showpagetotalput,maxperpage,"infotype.asp?id="&request("id")
else
currentpage=1
showpage1totalput,maxperpage,"infotype.asp?id="&request("id")
showcontent
showpagetotalput,maxperpage,"infotype.asp?id="&request("id")
endif
endif
endif
%>
subshowcontent()
%>
ID
选择
信息标题
更新日期
点击
添加人
编辑
删除
生成[归零]
i=1
dowhilenotrs.eof
%>
">
"target="_blank">[]
strcounts=truelen(thetitle1)
response.writethetitle1
%>
datetime=rs("datetime")
yname=year(datetime)
mname=month(datetime)
iflen(mname)
dname=month(datetime)
iflen(dname)
foldername=yname&mname
%>
/.htm"title="查看生成的静态页面"target="_blank">
">修改
)">删除
)">生成(','','width=0,height=0')">)
i=i+1
ifi>maxperpagethenexitdo
rs.movenext
loop
%>
ID
选择
信息标题
更新日期
点击
添加人
编辑
删除
生成
endsub
%>
functionshowpage(totalnumber,maxperpage,filename)
%>
dimn
iftotalnumbermodmaxperpage=0then
n=totalnumber/maxperpage
else
n=totalnumber/maxperpage+1
endif
%>
共有/条,
当前页/
[首页][上一页]
">[首页]&page=">[上一页]
[下一页][尾页]&page=">[下一页]&page=">[尾页]
转到:
onChange="location.href=this.options[this.selectedIndex].value">
ifcurrentpage=jthen
%>&page="selected>
else
%>
&page=">
endif
next
%>
endfunction
%>
functionshowpage1(totalnumber,maxperpage,filename)
%>
dimb
iftotalnumbermodmaxperpage=0then
b=totalnumber/maxperpage
else
b=totalnumber/maxperpage+1
endif
%>
共有/条,
当前页/
dxystart=currentpage-5
ifdxystart
dxyend=currentpage+5
ifdxyend>bthendxyend=b
fordxy=dxystarttodxyend
ifdxy=currentpagethen
response.write"["&"
else
response.write"["&dxy&""&"]"&""
endif
next
%>
endfunction
%>
rs.close
setrs=nothing
conn.close
setconn=nothing
%>
以上就是asp分页函数详细教程,想必都了解了吧,更多相关内容请继续关注错新技术频道。
新闻热点
疑难解答