一个关于下拉列表提交问题!!!高手进来看下!

swalp 2009-09-01 08:19:41
我做了个分页,但是用下拉列表选择页数的时候会出一些问题!当页面加载的时候下拉列表选择可以用。但是当我点击了上一页或下一页或尾页或首页的时候,下拉列表选择就不能用了。现在还是不明白怎么回事,不知道是没提交还是提交了没获取到值,代码帖出来大家看看。

获取值,计算的
<%
dim maxperpage
dim totalPut
dim CurrentPage
'修改此处用于修改每页显示的留言数量
maxperpage=20
if not isempty(request("p")) then
currentPage=cint(request("p"))
'response.write request("p")
else
currentPage=1
end if
sqlb="select id,title,name,date from zf11_gb"
rs.open sqlb,conn,1,3
response.write currentPage


%>
<%
if not rs.eof then
totalPut=rs.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
ShowMes
call showpage (totalput,MaxPerPage,"")
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
response.write request("p")
dim bookmark
bookmark=rs.bookmark
ShowMes
call showpage (totalput,MaxPerPage,"")
else
currentPage=1
ShowMes
call showpage (totalput,MaxPerPage,"")
end if
end if
end if
%>

提交的下拉列表,下拉列表不再FORM里
<%
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<table width='90%' border='0' align='center' cellpadding='3' cellspacing='0' class='BoderTab'>"
response.write "<form method=Post action="""&filename&"""><tr><td align=center>"

if CurrentPage<2 then
response.write "共<b><font color=red>"&totalnumber&"</font></b>条 首页 上一页 "
else
response.write "共<b><font color=red>"&totalnumber&"</font></b>条留言 "
response.write "<a href="&filename&"?O=1&p=1>首页</a> "
response.write "<a href="&filename&"?O=1&p="¤tPage-1&">上一页</a> "
end if

if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?O=1&p="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?O=1&p="&n&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"¤tPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>条留言/页 "
%>
转到:
<select name='p' size='1' style="font-size: 9pt" onChange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>'<%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select>
<input type=hidden name="O" value=1>
<%
response.write "</td></tr></FORM></table>"
end Function
%>

...全文
83 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
swalp 2009-09-01
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 jypcxgzl 的回复:]
你javascript的submit()贴出来看看呢?
[/Quote]
方法里没有任何东西,只是让它提交一下!!
swalp 2009-09-01
  • 打赏
  • 举报
回复
获取值的地方没贴出来,晕了,我是用Request获取的P的值!!!
number123456 2009-09-01
  • 打赏
  • 举报
回复
你可以在刚加载页面时查看一下生成的HTML,点完上一页下一页后,再查看一下生成的HTML,对比一下有哪不同
number123456 2009-09-01
  • 打赏
  • 举报
回复
    if currentPage=1 then
ShowMes
call showpage (totalput,MaxPerPage,"")
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
response.write request("p")
dim bookmark
bookmark=rs.bookmark
ShowMes
call showpage (totalput,MaxPerPage,"")
else
currentPage=1
ShowMes
call showpage (totalput,MaxPerPage,"")
end if

你的showpage不论什么情况都要调用,而且一样,你可以放到判断条件外来,这样代码至少少了两行,找错也好找
    
if currentPage<>1 then
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
response.write request("p")
dim bookmark
bookmark=rs.bookmark
else
currentPage=1
end if
end if
ShowMes
call showpage (totalput,MaxPerPage,"")

jypcxgzl 2009-09-01
  • 打赏
  • 举报
回复
你javascript的submit()贴出来看看呢?
swalp 2009-09-01
  • 打赏
  • 举报
回复
自己顶一下!别沉了!
md5e 2009-09-01
  • 打赏
  • 举报
回复
response.write "<form method=Post action="""&filename&"""><tr><td align=center>"



filename="当前文件名(不带任何参数)"
swalp 2009-09-01
  • 打赏
  • 举报
回复
到现在还没解决呢!真是一筹莫展阿!

28,409

社区成员

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

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