会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
PHP开发记录
PHP以及web前端(ajax,js,jquery等)
博客园
首页
新随笔
管理
多行多列的分页,与之前发的不同.
<
!
--
#include file
=
"
inc/conn.asp
"
-->
<
%
dim
i,intPage,page,pre,last,filepath
set
rs
=
server.CreateObject(
"
adodb.recordset
"
)
sql
=
"
select * from product
"
rs.PageSize
=
12
rs.CursorLocation
=
3
rs.Open sql,conn,
0
,
2
,
1
pre
=
true
last
=
true
page
=
trim
(Request.QueryString(
"
page
"
))
if
len
(page)
=
0
then
intpage
=
1
pre
=
false
else
if
cint
(page)
=<
1
then
intpage
=
1
pre
=
false
else
if
cint
(page)
>=
rs.PageCount
then
intpage
=
rs.PageCount
last
=
false
else
intpage
=
cint
(page)
end
if
end
if
end
if
if
not
rs.eof
then
rs.AbsolutePage
=
intpage
end
if
%
>
<
!
--
循环开始
-->
<
table
>
<
%
'
行循环判断 to后面是行数
for
i
=
1
to
3
%
>
<
tr
>
<
%
'
列循环判断 to后面是列数
for
j
=
1
to
4
if
not
rs.eof
then
%
>
<
td
>
显示内空
</
td
>
<
%
rs.movenext
else
%
>
<
td
>
</
td
>
<
%
end
if
next
%
>
</
tr
>
<
%
next
%
>
</
table
>
<
!
--
循环体结束
分页部分:
-->
<
table width
=
"
99%
"
border
=
"
1
"
cellpadding
=
"
2
"
cellspacing
=
"
2
"
borderColorLight
=
#
808080
borderColorDark
=
#ffffff
>
<
tr
>
<
Td width
=
"
10%
"
>
共有
<
%
=
rs.recordcount%
>
条记录
</
Td
>
<
%
if
rs.pagecount
>
0
then
%
>
<
td width
=
"
13%
"
align
=
"
left
"
>
当前页
<
%
=
intpage%
>/<
%
=
rs.PageCount%
></
td
>
<
%
else
%
>
<
td width
=
"
41%
"
align
=
"
left
"
>
当前页0
/
0
</
td
><
%
end
if
%
>
<
td width
=
"
46%
"
align
=
"
right
"
>
<
a href
=
"
?page=1
"
>
首页
</
a
>
|
<
%
if
pre
then
%
>
<
%
if
rs.pagecount
=
1
then
'
判断是否显示上页、下页
Response.Write
""
else
%
>
<
a href
=
"
?page=<%=intpage -1%>
"
>
上页
</
a
>
|
<
%
end
if
%
>
<
%
if
last
then
%
>
<
a href
=
"
?page=<%=intpage +1%>
"
>
下页
</
a
>
|
<
%
end
if
end
if
%
>
<
a href
=
"
?page=<%=rs.PageCount%>
"
>
尾页
</
a
>
|转到第
<
select
name
=
"
sel_page
"
>
<
%
for
i
=
1
to
rs.PageCount
if
i
=
intpage
then
%
>
<
option
value
=
"
?page=<%=i%>
"
selected
><
%
=
i%
></
option
>
<
%
else
%
>
<
option
value
=
"
?page=<%=i%>
"
><
%
=
i%
></
option
>
<
%
end
if
next
%
>
</
select
>
页
</
font
>
</
td
>
</
tr
>
</
table
>
发表于
2007-04-02 10:54
corange
阅读(
137
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告