廖雪峰python3视频:ASP制作网页分页的一个问题,请高手帮忙
?geshou=<%=server.URLEncode(Request.Form("geshou"))%>&page=2
将以上参数去掉,添加一个隐藏表单域,<input name='geshou' type='hidden' value='《%=request.form("geshou") %>'>
request.querystring 是用来接收地址里面?后面的xx=xx的内容
而request.form 是用来接收表单递交来的数据
或者你把request.form都改成request()吧。
希望可以帮到你,告诉我你的QQ,我会加你的,我们可以相互学习:)
还是不行啊我的代码是这个,点下一页还是没有数据
<%
geshou=request.form("geshou")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("yinyue.mdb")
%>
<%
exec="select * from yinyue where
geshou='"+geshou+"'"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
if rs.eof and rs.bof then
%>
<p align="center"> </p>
<p align="center">没有相关曲目!</p></td>
</tr><table>
<% else
dim MaxPerPage
dim sql
dim rs
dim gstBookID
dim totalPut
dim CurrentPage
dim TotalPages
filename="geshou.asp"
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
rs.pagesize=10
totalPut=rs.recordcount '记录总数
totalPage=rs.pagecount
MaxPerPage=rs.pagesize
if currentpage<1 then
currentpage=1
end if
if currentpage>totalPage then
currentpage=totalPage
end if
if currentPage=1 then
showContent
showpages1
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark '移动到开始显示的记录
位置
showContent
showpages1
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i,j
%>
<table width="400" align="left" border="0" class="default">
<%
i=1
do while not (rs.eof or err)
%>
<tr>
<td><font color="#990000" face="幼圆"><%=rs("leixing")%></font></td>
<td><font color="#0033CC" face="方正舒体, 方正姚体"><%=rs("geming")%></font></td>
<td><font color="#003333" face="黑体, 华文彩云"><%=rs("geshou")%></font></td>
<td><a href=<%=rs("lianjie")%> target='_blank'>收听</a></td>
<td><a href=<%=rs("xiazai")%> target='_blank'>下载</a></td>
</tr>
<%
if i>=MaxPerPage then exit do
i=i+1
rs.movenext
loop
%>
<tr>
<td height="140" colspan="3" align="center">
<%
end sub
%>
<%
sub showpages1()
dim n
n=totalPage
%>
<form action="<%=filename%>" method="post" align="right">
<table width="81%" height="30" border="0" cellpadding="0" cellspacing="0"
s="border-collapse: collapse" bordercolor="#111111">
<tr>
<td height="30">
<div align="right"> <span s="font-size:9pt"> 共<font
color="#FF0000"><%=totalPage%></font>页/<font color="red"><%=totalPut%></font>条信息
</span>
<% If currentPage <> 1 Then %>
<a href=<%=filename%>><font color="#FF6600"><span s="font-
size:9pt">[首页]</span></font></a> <a href=<%=filename%>?geshou=<%=server.URLEncode
(Request.Form("geshou"))%>&Page=<%=(currentPage-1)%>><font color="#FF6600"><span
s="font-size:9pt">[上一页]</span></font></a>
<% End If %>
<% If currentPage <> rs.PageCount Then %>
<a href=<%=filename%>?geshou=<%=server.URLEncode(Request.Form
("geshou"))%>&Page=<%=(currentPage+1)%>><font color="#FF6600"><span s="font-size:9pt">[
下一页]</span></font></a> <a href=<%=filename%>?Page=<%=totalPage%>><font
color="#FF6600"><span s="font-size:9pt">[尾页]</span></font></a>
<% End If %>
<span s="font-size:9pt"> 第<font color="#FF0000"><%
=currentPage%></font>页/共<font color="#FF0000"><%=totalPage%></font>页
<%
response.write " 转到:<select name='page' size=1 class=smallselsect s='font-family: 宋
体; font-size: 9pt;'>"
for i=1 to n
response.write "<option value="& i
if currentpage=i then
response.write " selected"
end if
response.write ">"& i &"</option>"
next
response.write "</select>"
response.write"<input name='types' type='hidden' value='"&request("types")&"'>"
response.write " <input class=buttonface type='submit' value='go' s='font-
family: 宋体; font-size: 9pt;'>"
%>
</span> </div></td>
</tr>
</table>
</form></td>
</tr>
</table>
<%end sub%>
</div></td>
</tr>
</table>