谁能帮我把这个asp的分页改了?(付代码)

yzhappy0000 2005-11-14 05:03:59
<td height="24" width="400">
<div align="right" ><font color="#000000">   </font>第<font color=#ff0000><%=pagenum%></font>页 <font color="#000000">
<%
for p=1 to rs.pagecount
response.write ("[")
response.write "<a href=index.asp?pagenum="&p&">"&p&"</a>"
response.write ("] ")
next
%>
</font>共<%=rs.pagecount%>页</div></td>
</tr>
显示效果
第1页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] 共23页
把我的网页都撑变形了,想改为一个下拉菜单的那种,谁来帮帮忙~!谢谢
...全文
240 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
sorrowman 2005-11-17
  • 打赏
  • 举报
回复
还是看我的吧.你可以不用下拉框的,你限制一次显示多少页就好了阿
只要在你的代码上加些条件就好了阿,很简单的
<%
dim i,pageend
if page=1 then
response.Write"第一页"
else
response.Write("<a href=fenye.asp?page=1>第一页</a>")
end if
if page< rs.pagecount-4 then
pageend=page+4
else
pageend=rs.pagecount
end if
for i= page to pageend
response.Write("<a href=fenye.asp?page="&i&">"&i&"</a>")
next
if page=rs.pagecount then
response.Write "最后一页"
else
response.Write("<a href=fenye.asp?page="&rs.pagecount&">最后一页</a>")
end if
%>
好了回阿
yzhappy0000 2005-11-17
  • 打赏
  • 举报
回复
to兔子:测试不行,从下拉中选择后页面没有反应,是不是要加<form>? script 加在asp的代码前后和<head>里都不行,帮我一下。
yzhappy0000 2005-11-17
  • 打赏
  • 举报
回复
谢谢 sorrowman(niaoren) 你的代码可以.也谢谢大家.
  • 打赏
  • 举报
回复
也没什么简单得很
<script language='javascript'>
function yyyy(){
var nnnnn=document.getElementById("xxx");
window.location.href=nnnnn.options[selectedindex].value;
}
</script>
没测试,如果有错,再给我发短消息,凑合写的
asp_m 2005-11-16
  • 打赏
  • 举报
回复
'***********************************************************
'函数名:PageSize
'作 用:显示信息分页
'参 数:PageNow ------ 是当前页
' PageTotal ---- 是总页数
' PageName ------ 是页的名称
' PageStr ------ 是其他参数
' Size ------- 每页的条数
'返回值:无
'************************************************************
Sub PageSize(PageNow,PageTotal,PageName,PageStr,Size)
Dim P
Response.Write vbCrlf
Response.Write "<style>" & vbCrlf
Response.Write "<!--" & vbCrlf
Response.Write "a.PageSizeSuba:link{text-decoration:underline;color:#0055bb;font-family:""Arial"";}" & vbCrlf
Response.Write "a.PageSizeSuba:visited{text-decoration:underline;color:#0055bb;font-family:""Arial"";}" & vbCrlf
Response.Write "a.PageSizeSuba:hover{text-decoration:none;color:#ff0000;font-family:""Arial"";}" & vbCrlf
Response.Write "a.PageSizeSuba:active{text-decoration:none;color:#ff0000;font-family:""Arial"";}" & vbCrlf
Response.Write "-->" & vbCrlf
Response.Write "</style>" & vbCrlf
Response.Write "<a class=PageSizeSuba href="&PageName&"?pages=1"&PageStr&">首页</a>  " & vbCrlf
If Cint(PageNow)>1 Then
Response.Write "<a class=PageSizeSuba href="&PageName&"?pages="&(Cint(PageNow)-1)&PageStr&">上一页</a>  " & vbCrlf
End If
If Int(PageNow) Mod 10 = 0 Then
For P=(PageNow-9) To PageNow
If P=PageNow Then
response.Write("<a class=""PageSizeSuba"" href="&PageName&"?pages="&P&PageStr&"><font color=red><b>"&P&"</b></font></a>  " & vbCrlf)
Else
response.Write("<a class=""PageSizeSuba"" href="&PageName&"?pages="&P&PageStr&">"&P&"</a>  " & vbCrlf)
End if
Next
Else
If Int(PageNow/10)*10+10 < PageTotal Then
For P=(Int(PageNow/10)*10+1) To Int(PageNow/10)*10+10
If P=PageNow Then
response.Write("<a class=""PageSizeSuba"" href="&PageName&"?pages="&P&PageStr&"><font color=red><b>"&P&"</b></font></a>  " & vbCrlf)
Else
response.Write("<a class=""PageSizeSuba"" href="&PageName&"?pages="&P&PageStr&">"&P&"</a>  " & vbCrlf)
End if
Next
Else
For P=(Int(PageNow/10)*10+1) To PageTotal
If P=PageNow Then
response.Write("<a class=""PageSizeSuba"" href="&PageName&"?pages="&P&PageStr&"><font color=red><b>"&P&"</b></font></a>  " & vbCrlf)
Else
response.Write("<a class=""PageSizeSuba"" href="&PageName&"?pages="&P&PageStr&">"&P&"</a>  " & vbCrlf)
End if
Next
End If
End If
If Cint(PageNow)<Cint(PageTotal) Then
Response.Write "<a class=""PageSizeSuba"" href="&PageName&"?pages="&(Cint(PageNow)+1)&PageStr&">下一页</a>  " & vbCrlf
End If
Response.Write "<a class=""PageSizeSuba"" href="&PageName&"?pages="&PageTotal&PageStr&">尾页</a>  " & vbCrlf
Response.Write ""&PageNow&"/"&PageTotal&"页  " & vbCrlf
Response.Write ""&Size&"条/页  " & vbCrlf
Response.Write "<select name=selpage onchange=""javascript:eval(document.location='"&PageName&"?pages='+this.options[this.selectedIndex].value+'"&PageStr&"');"">" & vbCrlf
For P = 1 To PageTotal
Response.Write "<option value="&P
If CInt(PageNow) = CInt(P) Then
Response.Write " selected"
End If
Response.Write ">第"&P&"页</option>" & vbCrlf
Next
Response.Write "</select>" & vbCrlf
End Sub


============================================
可供楼主参考,接点分过冬哦:)
xiangyx 2005-11-16
  • 打赏
  • 举报
回复
不会,学了一把。
king_shadow 2005-11-16
  • 打赏
  • 举报
回复
<script language="JavaScript">
<!--
function FP_jumpMenu(el,frm,sel) {//v1.0
var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}
// -->
</script>
<select size="1" onchange="FP_jumpMenu(this,'window',false)">
<%
dim shownum
shownum = rs.pagecount '这个是你以前的,下面的就显示5页了
'shownum = 5
for p=1 to shownum
%>
<option value="index.asp?pagenum=<%=p%>" <%if pagenum=p then response.write "selected"%>>第<%=p%>页
</option>
<%next%>
</select>


龙宜坡 2005-11-15
  • 打赏
  • 举报
回复
兔子可行!
yzhappy0000 2005-11-15
  • 打赏
  • 举报
回复
有没有简单一点儿的方法在asp里套js我不太会。
text44 2005-11-15
  • 打赏
  • 举报
回复
<%
response.write ("<select id='xxx' onChange=""javascript:location.href='y.asp?page=xxx.options[xxx.selectedindex].value'"">")
for p=1 to rs.pagecount

response.write "<option value=" &p & ">" & p & "</option>"

next
response.write ("</select")
%>
yzhappy0000 2005-11-15
  • 打赏
  • 举报
回复
谢谢兔子,我是试了可以,但我还想在下拉选择页数后实现跳转。在帮帮忙,谢谢
text44 2005-11-15
  • 打赏
  • 举报
回复
xxx.selectedindex
这个也是 有FORM要加FORM的
text44 2005-11-15
  • 打赏
  • 举报
回复
提供的只是方法,思路
里面的ID名字 什么的你还是要自己改的 如果有FORM什么的还要加FORM的名字的
y.asp?page=xxx.options
主要是这块要改好
yzhappy0000 2005-11-15
  • 打赏
  • 举报
回复
text44(text) 兄 的方法不行啊~!是不是那里有问题~!
  • 打赏
  • 举报
回复
response.write ("</select>")
  • 打赏
  • 举报
回复
<%
response.write ("<select id='xxx' onpropertychange='yyyy()'>")
for p=1 to rs.pagecount

response.write "<option value=" &p & ">" & p & "</option>"

next
response.write ("</select")
%>
moodboy1982 2005-11-14
  • 打赏
  • 举报
回复
楼上的方法显然不可行,太简单。
你还要考虑到,显示完这5页后,那后面的呢?不用显示了吗/
oyleme 2005-11-14
  • 打赏
  • 举报
回复
<td height="24" width="400">
<div align="right" ><font color="#000000">   </font>第<font color=#ff0000><%=pagenum%></font>页 <font color="#000000">
<%
dim shownum
shownum = rs.pagecount '这个是你以前的,下面的就显示5页了
'shownum = 5
for p=1 to shownum
response.write ("[")
response.write "<a href=index.asp?pagenum="&p&">"&p&"</a>"
response.write ("] ")
next
%>
</font>共<%=shonum%>页</div></td>
</tr>

28,390

社区成员

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

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