标题:[求助]关于页码的问题
只看楼主
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
 问题点数:0 回复次数:9 
[求助]关于页码的问题

<%call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center class='zhengwen'>")


Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

Dim t
t = ""
if pro_type <> 0 then t = t & "&pro_type=" & pro_type
if pro_type2 <> 0 then t = t & "&pro_type2=" & pro_type2
if pro_name <> "无" then t = t & "&keyword=" & Server.URLEncode(pro_name)

Response.Write("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("首页 " & vbCrLf)
Response.Write ("上页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1"& t &">首页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & t &">上页</A> " & vbCrLf)
end if

if page>=pagecount then
Response.Write ("下页 " & vbCrLf)
Response.Write ("尾页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & t &">下页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount &t & ">尾页</A> " & vbCrLf)
end if

Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "种商品" & vbCrLf)
Response.Write(" 转到" & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 VALUE=" & page & ">" &"页" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO class=b2>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>

根据上面红色的蓝色的这段要怎么改?不然按回车或一点go就跳到大类的第几页了

[此贴子已经被作者于2007-8-17 22:08:02编辑过]

搜索更多相关主题的帖子: 页码 pro type 
2007-08-17 19:53
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
可能楼主的页面条转错误,估计跟红色的代码没什么关系。
2007-08-17 21:57
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
if pro_type <> 0 then t = t & "&pro_type=" & pro_type
if pro_type2 <> 0 then t = t & "&pro_type2=" & pro_type2
if pro_name <> "无" then t = t & "&keyword=" & Server.URLEncode(pro_name)
这些内容是某个网页的参数
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
这句话应该是取得当前页的URL
2007-08-17 22:13
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
得分:0 

我是说蓝色这段怎么改才能象前面上页,下页这样

2007-08-17 22:13
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
得分:0 
难道就没有人会改下吗??????????????、
2007-08-18 11:24
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 

Dim t
t = ""
if Request("pro_type") <> 0 then t = t & "pro_type=" &Request("pro_type")
if Request("pro_type2") <> 0 then t = t & "pro_type2=" & Request("pro_type2")
if Request("pro_name") <> "无" then t = t & "keyword=" & Server.URLEncode(Request("pro_name"))

Response.Write("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & t & "&Page='+ this.page.value;return false;""><TR>" & vbCrLf )

试试看。

2007-08-18 16:34
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
得分:0 
没用,
Response.Write(" 转到" & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 VALUE=" & page & ">" &"页" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO class=b2>")

& page &这个不能改,能不能把这个手工输入页码换成下拉列表形式,那就能实现了,可我不知道怎么做下拉列表
2007-08-18 19:39
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
得分:0 
以下是引用yms123在2007-8-18 16:34:01的发言:

Dim t
t = ""
if Request("pro_type") <> 0 then t = t & "pro_type=" &Request("pro_type")
if Request("pro_type2") <> 0 then t = t & "pro_type2=" & Request("pro_type2")
if Request("pro_name") <> "无" then t = t & "keyword=" & Server.URLEncode(Request("pro_name"))

Response.Write("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & t & "&Page='+ this.page.value;return false;""><TR>" & vbCrLf )

试试看。

这段没用,受你启发,我现在想这么来,可不知道应该怎么写
<script language="javascript">
function selPage_Change(txt)
{
self.location="product.asp?Page="+txt+"&t&";
}
</script>

Response.Write(" 转到" & "<select name=""select"" onChange="selPage_Change(this.options[this.selectedIndex].text);">
"<%for i=1 to Pagecount %>
<option><%=i%></option>
<% next %>"
</select>
" & "页" & vbCrLf & )

我知道这样写是错的,请你写个对的好吗?我这样提示出错

[此贴子已经被作者于2007-8-18 20:06:52编辑过]

2007-08-18 20:06
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
得分:0 
回复:(xinzheng)以下是引用yms123在2007-8-18 16:3...

完整的代码是这样的

<% call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
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("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
Response.Write(font_style & vbCrLf )

if page<=1 then
Response.Write ("首页 " & vbCrLf)
Response.Write ("上页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
end if

if page>=pagecount then
Response.Write ("下页 " & vbCrLf)
Response.Write ("尾页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾页</A> " & vbCrLf)
end if

Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 共有" & iCount & "种商品" & vbCrLf)
Response.Write(" 转到" & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO class=b2>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>

[此贴子已经被作者于2007-8-18 22:16:16编辑过]

2007-08-18 22:13
xinzheng
Rank: 1
等 级:新手上路
帖 子:193
专家分:0
注 册:2007-7-22
得分:0 
哈哈,终于被我搞定了

此问题结贴!!!!!!!!!!!!!!!!

[此贴子已经被作者于2007-8-18 22:56:55编辑过]

2007-08-18 22:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-163569-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.245898 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved