一个分页的问题,请高手帮忙看看,谢谢!

firects 2005-05-13 10:01:41
<%
for m=0 to u
for n=0 to m-1
if id(m)=id(n) then
id(m)=""
end if
next
if id(m)<>"" then
clientid=id(m)
sql="Select * FROM client where clientid='"&clientid&"'"
set rs=server.createobject("adodb.recordset")
rs.open Sql,Conn,1,3

%>
<tr align="center" bgcolor="#0099CC">
<td height="26"> <input type="checkbox" name="clientid" value="<%=rs("clientid")%>"></td>
<td height="26" bgcolor="#0099CC"><a href=viewclient.asp?clientid=<%=rs("clientid")%> target="_blank"><%=rs("client")%></a></td>
<td height="26"><%=rs("address")%></td>
<td height="26"><%=rs("contact")%></td>
<td height="26"><%=rs("clienttype")%></td>
<td height="26"><%=rs("biztype")%></td>
<td height="26"><%=rs("contactphone")%> </td>
</tr>
<%
end if
next

%>

请高手指点一下,这段程序如何分页显示出来,或是可以怎样改进,谢谢!
...全文
120 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
firects 2005-05-16
  • 打赏
  • 举报
回复
谢谢各位!
itzhiren 2005-05-14
  • 打赏
  • 举报
回复
http://itzhiren.blogdriver.com/itzhiren/674015.html
leo963258 2005-05-14
  • 打赏
  • 举报
回复
<%
sql="Select * FROM client where clientid='"&clientid&"'"
set rs=server.createobject("adodb.recordset")
rs.open Sql,Conn,1,3

for m=0 to u
for n=0 to m-1
if id(m)=id(n) then
id(m)=""
end if
next
if id(m)<>"" then
clientid=id(m)
%>
<tr align="center" bgcolor="#0099CC">
<td height="26"> <input type="checkbox" name="clientid" value="<%=rs("clientid")%>"></td>
<td height="26" bgcolor="#0099CC"><a href=viewclient.asp?clientid=<%=rs("clientid")%> target="_blank"><%=rs("client")%></a></td>
<td height="26"><%=rs("address")%></td>
<td height="26"><%=rs("contact")%></td>
<td height="26"><%=rs("clienttype")%></td>
<td height="26"><%=rs("biztype")%></td>
<td height="26"><%=rs("contactphone")%> </td>
</tr>
<%
end if
next
%>
poonzsp 2005-05-13
  • 打赏
  • 举报
回复
给你个例子`~
<%
if rs.eof and rs.bof then
Response.Write("<div align='center'><font color=#ff0000>没有找到相关记录!</font></div>")
else

if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

MaxPerPage=20 '设置条数
PageUrl="index.asp"
totalPut=rs.recordcount
if currentpage<1 then currentpage=1
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
'showpage totalput,MaxPerPage,PageUrl
showContent
showpage totalput,MaxPerPage,PageUrl
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
'showpage totalput,MaxPerPage,PageUrl
showContent
showpage totalput,MaxPerPage,PageUrl
else
currentPage=1
'showpage totalput,MaxPerPage,PageUrl
showContent
showpage totalput,MaxPerPage,PageUrl
end if
end if
end if
rs.close

sub showContent
i=0
do while not rs.eof
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<%
t=0
For i=1 to rs.recordcount
%>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="80" rowspan="5"><a href="productshow.asp?id=<% =rs("id")%>" title='<% =rs("productname")%>' target="_blank"><img src="<% =rs("smallphoto")%>" width="120" height="120" border="0"></a></td>
<td>产品名称:<a href="productshow.asp?id=<% =rs("id")%>" title='<% =rs("productname")%>'>
<% =rs("productname")%>
</a></td>
</tr>
<tr>
<td>产品编号:
<% =rs("codify")%>
</td>
</tr>
<tr>
<td>产品价格: 元 </td>
</tr>
<tr>
<td>会员价格: 元 </td>
</tr>
<tr>
<td><a href="productshow.asp?id=<% =Server.URLEncode(rs("id"))%>" title='<% =rs("productname")%>' target="_blank"><img src="images/aad.gif" width="65" height="20" border="0"></a>
<%
if session("username")<>"" then
response.Write "<a href='eshop_Test.asp?productID="&rs("ID")&"' onClick='return newpage(this.href);'>"
else
%><A onClick="javascript:alert('对不起!请先登录...只有会员才有此功能!');">
<%
end if

response.Write " <img src='images/buy.gif' width='65' height='20' border='0'></a>"

%>
</tr>
</table>
<br> </td>
<%
t=t+1
if t=2 then
t=0
%>
</tr>
<%
end if
rs.movenext
if rs.EOF then exit for
if i>=MaxPerPage then exit do
next
i=i+1
loop
%>
</table>
<%
end sub
%>
<%
function showpage(totalnumber,maxperpage,filename)
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
url="sortID=" & sortID
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form method="Post" action="<%=filename%>?<%=url%>" name="formpage">
<tr>
<td align="center">共 <font color="#ff0000"><b><%=totalnumber%></b></font>
条记录
<%if CurrentPage<2 then%>
 首页  上一页 
<%else%>
 <a href="<%=filename%>?page=1&<%=url%>">首页</a> 
<a href="<%=filename%>?page=<%=CurrentPage-1%>&<%=url%>">上一页</a> 
<%
end if
if n-currentpage<1 then
%>
下一页  末页
<%else%>
<a href="<%=filename%>?page=<%=CurrentPage+1%>&<%=url%>">下一页</a>
 <a href="<%=filename%>?page=<%=n%>&<%=url%>">末页</a>
<%end if%>
 页次:<strong><font color="#ff0000"><%=CurrentPage%>/<%=n%></font></strong>页
转到:
<select name="page" size="1" onChange="javascript:submit()">
<%for i = 1 to n%>
<option value="<%=i%>" <%if cint(CurrentPage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select> </td>
</tr>
</form>
</table>
<%end function%>

28,406

社区成员

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

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