ASP分页显示中出现的问题
<%Functionpagination(pagecount,pagesize,page,resultcount)Dimquery,a,x,tempaction="htt...
<%
Function pagination(pagecount,pagesize,page,resultcount)
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+this.page.value;return false;"">")
if page<=1 then
Response.Write ("[首页] [上一页] ")
else
Response.Write("[<a href=" & action & "?" & temp & "Page=1>首页</a>] ")
Response.Write("[<a href=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</a>] ")
end if
if page>=pagecount then
Response.Write ("[下一页] [尾页]")
else
Response.Write("[<a href=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</a>] ")
Response.Write("[<a href=" & action & "?" & temp & "Page=" & pagecount & ">尾页</a>]")
end if
Response.Write("[页次:<font color=red>" & page & "</font>/" & pageCount)
Response.Write("] [共" & resultcount & "条 <font color=red>"& pagesize & "</font>条/页]")
Response.Write(" 转到" & "<input name=page size=4 value=" & page & ">" & "页<input type=submit value=go>")
End function
%>
以上是分页语句的主程式,问题是,假如SQL查询是全部的话,可以正确使用,但如果在页面上做一个表单,加入一个文本框输入查询条件,经过按钮提交之后,第一页显示会按原来的内容,但点下一页后就变回查询全部内容,请问高手,这个问题该如何解决 展开
Function pagination(pagecount,pagesize,page,resultcount)
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+this.page.value;return false;"">")
if page<=1 then
Response.Write ("[首页] [上一页] ")
else
Response.Write("[<a href=" & action & "?" & temp & "Page=1>首页</a>] ")
Response.Write("[<a href=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</a>] ")
end if
if page>=pagecount then
Response.Write ("[下一页] [尾页]")
else
Response.Write("[<a href=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</a>] ")
Response.Write("[<a href=" & action & "?" & temp & "Page=" & pagecount & ">尾页</a>]")
end if
Response.Write("[页次:<font color=red>" & page & "</font>/" & pageCount)
Response.Write("] [共" & resultcount & "条 <font color=red>"& pagesize & "</font>条/页]")
Response.Write(" 转到" & "<input name=page size=4 value=" & page & ">" & "页<input type=submit value=go>")
End function
%>
以上是分页语句的主程式,问题是,假如SQL查询是全部的话,可以正确使用,但如果在页面上做一个表单,加入一个文本框输入查询条件,经过按钮提交之后,第一页显示会按原来的内容,但点下一页后就变回查询全部内容,请问高手,这个问题该如何解决 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询