请帮我修改asp代码中出现页面分页的问题
这页在不搜索的情况下就可以点击下一页,如果是搜索情况下点下一页就出错了,以下是我发的代码请高手帮忙修改一下,由于限制字数我整页代码发不出来,非常感谢!我的QQ:45095...
这页在不搜索的情况下就可以点击下一页,如果是搜索情况下点下一页就出错了,以下是我发的代码请高手帮忙修改一下,由于限制字数我整页代码发不出来,非常感谢!我的QQ:450954973
共<%=PageCount%>页 第<%=page%>页★
<%if page=1 then%>首页<%end if%>
<%if page>1 then%>
<A HREF="cw_pay.asp?page=1&cx=<%=cx%>"> 首页</A>
<%end if%>★
<%if page>1 then%><A HREF="cw_pay.asp?page=<%=page-1%>&cx=<%=cx%>"><%end if%>上一页</a>
<%
dim pagewhere
dim p
p = 1
'把pagewhere转换成整数
'pagewhere = cint(request("pagewhere"))
pagewhere = pageCount
if pagewhere>0 then
for p=1 to pagewhere
if p <> page then%>
<A HREF="cw_pay.asp?page=<%=p%>&cx=<%=cx%>"><%=p%></a>
<%end if
if p =page then%>
<%=p%>
<% end if
next
end if%>
<%if page < PageCount then%>
<A HREF="cw_pay.asp?page=<%=page+1%>&cx=<%=cx%>">
<%end if %>下一页</A>★
<%if page=PageCount then%>尾页
<%end if%>
<%if page<PageCount then%>
<A HREF="cw_pay.asp?page=<%=PageCount%>&cx=<%=cx%>"> 尾页</A>
<%end if%>共<%=tttt%>条记录
哎,我只能发这段代码了,本来想整也发出来请教修改的,可限制太厉害,发不上来 展开
共<%=PageCount%>页 第<%=page%>页★
<%if page=1 then%>首页<%end if%>
<%if page>1 then%>
<A HREF="cw_pay.asp?page=1&cx=<%=cx%>"> 首页</A>
<%end if%>★
<%if page>1 then%><A HREF="cw_pay.asp?page=<%=page-1%>&cx=<%=cx%>"><%end if%>上一页</a>
<%
dim pagewhere
dim p
p = 1
'把pagewhere转换成整数
'pagewhere = cint(request("pagewhere"))
pagewhere = pageCount
if pagewhere>0 then
for p=1 to pagewhere
if p <> page then%>
<A HREF="cw_pay.asp?page=<%=p%>&cx=<%=cx%>"><%=p%></a>
<%end if
if p =page then%>
<%=p%>
<% end if
next
end if%>
<%if page < PageCount then%>
<A HREF="cw_pay.asp?page=<%=page+1%>&cx=<%=cx%>">
<%end if %>下一页</A>★
<%if page=PageCount then%>尾页
<%end if%>
<%if page<PageCount then%>
<A HREF="cw_pay.asp?page=<%=PageCount%>&cx=<%=cx%>"> 尾页</A>
<%end if%>共<%=tttt%>条记录
哎,我只能发这段代码了,本来想整也发出来请教修改的,可限制太厉害,发不上来 展开
1个回答
展开全部
你这个写的太乱了吧。看的累死。给你个参考。把参数传进去就会输出你要的格式
iCur为当前页, iRecords总记录数, iPerPage当前输出条目数, iLists 显示页数如(2,3,4), sParam 为页面代码 如:a.asp?keyword=" & keyword &"&page="
Public Sub ShowPage(iCur, iRecords, iPerPage, iLists, sParam)
Dim iBegin, iEnd, iPages, i,TempPage
iPages = (iRecords\iPerPage)
If (iRecords Mod iPerPage)>0 Then iPages = iPages+1
If 1>=iPages Then Response.Write("<div class=""manuPage""><span class=""current"">共 "& iRecords &" 条信息 1 页</span></div>"):Exit Sub
TempPage="<link href="""&AdminFolder&"/inc/page.css"" rel=""stylesheet"" type=""text/css"" />"
iBegin = iCur
iEnd = iCur
i = iLists
Do While True
If iBegin>1 Then
iBegin = iBegin-1
i = i-1
End If
If i>1 And iEnd<iPages Then
iEnd = iEnd+1
i = i-1
End If
If (iBegin<=1 And iEnd>=iPages) Or i<=1 Then Exit Do
Loop
TempPage =TempPage &"<div class=""manuPage""><span class=""current"">共 "& iRecords &"条信息 "& iPages & "页</span>"
If iBegin<>1 Then TempPage =TempPage &"<a href=""" & sParam & "1"">首页</a>"
If iCur<>1 Then TempPage =TempPage &"<a href=""" & sParam & (iCur-1) & """>上一页</a>"
For i=iBegin To iEnd
If i=iCur Then
TempPage =TempPage &"<a class=""current"" href=""javascript://;"">" & i & "</a>"
Else
TempPage =TempPage &"<a href=""" & sParam & i & """>" & i & "</a>"
End If
Next
If iCur<>iPages Then TempPage =TempPage &"<a href=""" & sParam & (iCur+1) & """>下一页</a>"
If iEnd<>iPages Then TempPage =TempPage &"<a href=""" & sParam & iPages & """>末页</a>"
If iPages>1 Then TempPage =TempPage &"<input type=""text"" title=""输入数字,回车跳转"" size=""3"" onkeydown=""if (13==event.keyCode) document.location.href='"& sParam &"'+this.value"" value="""&iCur&""" />"
TempPage =TempPage &"</div>"
Response.Write TempPage
End Sub
以下为CSS样式。自行修改颜色代码
DIV.manuPage {
PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: left;
}
DIV.manuPage A {
PADDING-RIGHT: 5px;
PADDING-LEFT: 5px;
PADDING-BOTTOM: 2px;
MARGIN-RIGHT: 2px;
PADDING-TOP: 2px;
TEXT-DECORATION: none;
border: 1px solid #74B0ED;
}
DIV.manuPage A:hover {
COLOR: #fff;
background-color: #0696d8;
border: 1px solid #74B0ED;
}
DIV.manuPage A:active {
COLOR: #fff;
background-color: #0696d8;
border: 1px solid #0696d8;
}
DIV.manuPage a.current {
BORDER: #0696d8 1px solid; PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: bold; BACKGROUND: #0696d8; PADDING-BOTTOM: 2px; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px;
}
DIV.manuPage SPAN.current {
PADDING-RIGHT: 5px;
PADDING-LEFT: 5px;
PADDING-BOTTOM: 2px;
MARGIN-RIGHT: 2px;
PADDING-TOP: 2px;
}
DIV.manuPage SPAN.disabled {
BORDER-RIGHT: #f3f3f3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3f3f3 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #f3f3f3 1px solid; COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #f3f3f3 1px solid
}
DIV.manuPage input{
border: 1px solid #74B0ED;
vertical-align:middle;
}
iCur为当前页, iRecords总记录数, iPerPage当前输出条目数, iLists 显示页数如(2,3,4), sParam 为页面代码 如:a.asp?keyword=" & keyword &"&page="
Public Sub ShowPage(iCur, iRecords, iPerPage, iLists, sParam)
Dim iBegin, iEnd, iPages, i,TempPage
iPages = (iRecords\iPerPage)
If (iRecords Mod iPerPage)>0 Then iPages = iPages+1
If 1>=iPages Then Response.Write("<div class=""manuPage""><span class=""current"">共 "& iRecords &" 条信息 1 页</span></div>"):Exit Sub
TempPage="<link href="""&AdminFolder&"/inc/page.css"" rel=""stylesheet"" type=""text/css"" />"
iBegin = iCur
iEnd = iCur
i = iLists
Do While True
If iBegin>1 Then
iBegin = iBegin-1
i = i-1
End If
If i>1 And iEnd<iPages Then
iEnd = iEnd+1
i = i-1
End If
If (iBegin<=1 And iEnd>=iPages) Or i<=1 Then Exit Do
Loop
TempPage =TempPage &"<div class=""manuPage""><span class=""current"">共 "& iRecords &"条信息 "& iPages & "页</span>"
If iBegin<>1 Then TempPage =TempPage &"<a href=""" & sParam & "1"">首页</a>"
If iCur<>1 Then TempPage =TempPage &"<a href=""" & sParam & (iCur-1) & """>上一页</a>"
For i=iBegin To iEnd
If i=iCur Then
TempPage =TempPage &"<a class=""current"" href=""javascript://;"">" & i & "</a>"
Else
TempPage =TempPage &"<a href=""" & sParam & i & """>" & i & "</a>"
End If
Next
If iCur<>iPages Then TempPage =TempPage &"<a href=""" & sParam & (iCur+1) & """>下一页</a>"
If iEnd<>iPages Then TempPage =TempPage &"<a href=""" & sParam & iPages & """>末页</a>"
If iPages>1 Then TempPage =TempPage &"<input type=""text"" title=""输入数字,回车跳转"" size=""3"" onkeydown=""if (13==event.keyCode) document.location.href='"& sParam &"'+this.value"" value="""&iCur&""" />"
TempPage =TempPage &"</div>"
Response.Write TempPage
End Sub
以下为CSS样式。自行修改颜色代码
DIV.manuPage {
PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: left;
}
DIV.manuPage A {
PADDING-RIGHT: 5px;
PADDING-LEFT: 5px;
PADDING-BOTTOM: 2px;
MARGIN-RIGHT: 2px;
PADDING-TOP: 2px;
TEXT-DECORATION: none;
border: 1px solid #74B0ED;
}
DIV.manuPage A:hover {
COLOR: #fff;
background-color: #0696d8;
border: 1px solid #74B0ED;
}
DIV.manuPage A:active {
COLOR: #fff;
background-color: #0696d8;
border: 1px solid #0696d8;
}
DIV.manuPage a.current {
BORDER: #0696d8 1px solid; PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: bold; BACKGROUND: #0696d8; PADDING-BOTTOM: 2px; COLOR: #fff; MARGIN-RIGHT: 2px; PADDING-TOP: 2px;
}
DIV.manuPage SPAN.current {
PADDING-RIGHT: 5px;
PADDING-LEFT: 5px;
PADDING-BOTTOM: 2px;
MARGIN-RIGHT: 2px;
PADDING-TOP: 2px;
}
DIV.manuPage SPAN.disabled {
BORDER-RIGHT: #f3f3f3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f3f3f3 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; BORDER-LEFT: #f3f3f3 1px solid; COLOR: #ccc; MARGIN-RIGHT: 2px; PADDING-TOP: 2px; BORDER-BOTTOM: #f3f3f3 1px solid
}
DIV.manuPage input{
border: 1px solid #74B0ED;
vertical-align:middle;
}
追问
能否告诉你QQ呀,我发给你帮我修改一下,真是给你添麻烦了
追答
149737
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询