一个关于分页实现的问题!请大家帮帮忙,再现等待!急!

tfhui928 2003-08-18 04:08:12
下面的分页功能已实现了运行通过了(通过调用函数实现的),但有一个问题,就是在显示序号时(我想每一页显示十条纪录,第一页序号从1到10,第二页从11到。。,
但现在是每一页显示时序号都是从1开始10结束)谁能帮我看看如何实现我要达到的要求。
<%
dim rsC
dim intpagecount,totalPut '定义变量
const maxperpage=10
dim CurrentPage '定义变量

if request("page")="" then
CurrentPage =1
else
Currentpage=request("page")
end if
%>
<%
'输出数据库内容 函数
sub showContent
dim i ,inti
i=0
inti=1
Response.write"<center><table border=1 border color=orange cellPadding=1 cellSpacing=1>"
Response.Write "<TR>"

'表头信息 (序号是自己添加的标记)
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"序 号"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"教师名"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"课程名"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"周次"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"星期"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"上机时间"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"班级"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"上机地点"&"</b></font></center></TD>"
Response.write"<TD width="&"60"&"><center><font color=#0066FF><b>"&"上网"&"</b></font></center></TD>"
Response.Write "</TR>"

do while not rsC.eof'输出数据库内容

Response.Write "<tr>"
Response.Write "<td>"
。。。。。。。。。。。 Response.Write inti 。。。。。。。。。。
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("Teacher_Name")
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("Course_Name")
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("week")
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("day")
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("time_description")
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("Class_Name")
Response.Write "</td>"

Response.Write "<td>"
Response.Write rsC("lab_room_id")
Response.Write "</td>"

if rsC("net_state")=true then '如果最后一项字段值为true则执行下一条语句
response.write"<td><font color=blue><b>" &"需要"&"</b></font></td>"
else '如果最后一项字段值为false则执行下一条语句
response.write"<td><font color=red><b>" &"不需要"&"</b></font></td>"
end if

Response.Write "</tr>"
。。。。。。。。。。。。 inti=inti+1 。。。。。。。。。。。。
i=i+1
if i>=MaxPerPage then exit do
rsC.MoveNext
loop
end sub

if rsC.eof and rsC.bof then
response.write "<p align='center'>表中没有记录</p>"
else
totalPut=rsC.recordcount
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
showContent
showpage totalput,MaxPerPage,"course_teacher.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rsC.move (currentPage-1)*MaxPerPage
showContent
showpage totalput,MaxPerPage,"course_teacher.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"course_teacher.asp"
end if
end if
rsC.close
end if
%〉
________________________________________________________________________
'分页函数
<%
function showpage(totalnumber,maxperpage,filename)
dim n, i
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&">"%>
if CurrentPage<2 then
response.write "共"&totalnumber&"条纪录 首页 上一页 "
else
response.write "共"&totalnumber&"条纪录 <a href="&filename&"?page=1"&">首页</a> "
response.write "<a href="&filename&"?page="¤tPage-1&">上一页</a> "
end if

if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"¤tPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>条纪录/页 "
%>
转:
<select name='page' size='1' onchange='javascript:submit()' class="smallinput" >
<%for i = 1 to n%>
<option value='<%=i%>' <%if cint(CurrentPage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select>
</form>
...全文
101 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhuyangfeng 2003-08-18
  • 打赏
  • 举报
回复
rs.move (page-1)*pagesize+1
for ipage=1 to pagesize
recno=(page-1)*pagesize+ipage

用这个就搞定
tfhui928 2003-08-18
  • 打赏
  • 举报
回复
weizi2000(秋风啊):
多谢了!!
楚人无衣 2003-08-18
  • 打赏
  • 举报
回复
Response.Write inti
改成
Response.Write (Currentpage-1)*MaxPerPage+inti+1
iceriver521 2003-08-18
  • 打赏
  • 举报
回复
思路都这么清晰了还不知道呢,愁死我了!这可咋整!
iceriver521 2003-08-18
  • 打赏
  • 举报
回复
初始化的时候这样写:inti =(i-1) *maxperpage + 1


= = = = = = = = = = = = = = = = = = = = = = = = =

MSN:chenyongcai@msn.com
EMALI:iceriver521@163.com
= = = = = = = = = = = = = = = = = = = = = = = = =
楚人无衣 2003-08-18
  • 打赏
  • 举报
回复
Response.Write inti
改成
(Currentpage-1)*MaxPerPage+inti+1
tfhui928 2003-08-18
  • 打赏
  • 举报
回复
还是不行
iceriver521 2003-08-18
  • 打赏
  • 举报
回复
初始化的时候这样写:inti =i(第<%=i%>页) *maxperpage(const maxperpage=10)
扩号内为解释,
然后在如下


Response.Write "<tr>"
Response.Write "<td>"
。。。。。。。。。。。 Response.Write inti 。。。。。。。。。。
Response.Write "</td>"
michaelsheyong 2003-08-18
  • 打赏
  • 举报
回复
瓦,太长了,看的好累啊。
tfhui928 2003-08-18
  • 打赏
  • 举报
回复
谁能帮帮忙,再线等待,急!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧