=====ASP产品页面序号高分征解(在线等)===

moffatt 2004-12-05 11:18:22
见图:
http://www.greenerylighting.com/snap1.jpg

能否将图片下面的产品页面序号更改为图片上面那种只是显示“数字”的形式,简单实用。

下面产品页面序号的代码如下:
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "<table align='center'><form name='showpages' method='Post' action='" & sfilename & "'><tr><td>"
if ShowTotal=true then
strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "  "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
else
strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a> "
end if

if n-currentpage<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a> "
strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
end if
strTemp=strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到:<select name='page' size='1' onchange='javascript:submit()'>"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & i & "页</option>"
next
strTemp=strTemp & "</select>"
end if
strTemp=strTemp & "</td></tr></form></table>"
response.write strTemp
end sub
...全文
98 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
DARKNESSFALL 2004-12-05
UP
回复
moffatt 2004-12-05
分析:

如果设计成只显示数字的页面序号,只要取代码中总的页码就可以了吗?
回复
纪俊 2004-12-05
分页的例子:

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="t1">
<tr>
<td colspan="5" valign="top"><IMG SRC="../images/user-1_08.gif" WIDTH=1 HEIGHT=1></td>
</tr>
<tr valign="top" bgcolor="#FCD2EE">
<td height="30" colspan="5" align="left"><img src="../images/icon1.gif"><a href="write.asp">+日记</a>  <a href="index.asp">+心情日记</a></td>
</tr>
<tr bgcolor="#ffcccc">
<td width="23%" height="30">日期</td>
<td width="47%" height="30">标题</td>
<td width="8%"> 保密</td>
<td width="8%">浏览数</td>
<td width="14%">操作</td>
</tr>
<%
dim i,intPage,page,pre,last,filepath
set rs = server.CreateObject("adodb.recordset")
sql="select id,savetime,title,hits,issecret from f_diaries where uid='"&session("uid")&"' order by id desc"

rs.PageSize = 20 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))

if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
%>
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%>
<tr>
<td height="25"><%=trim(rs("savetime"))%></td>
<td height="25" align="left"><a href="show.asp?id=<%=trim(rs("id"))%>"><%if len(trim(rs("title")))>20 then
response.Write left(trim(rs("title")),20)
response.Write "..."
else
response.Write trim(rs("title"))
end if
%></a></td>
<td><%if rs("issecret")=0 then%>公开<%else%>保密<%end if%></td>
<td height="25"><%=trim(rs("hits"))%></td>
<td height="25"><a href="del.asp?id=<%=trim(rs("id"))%>">删除</a> <a href="change.asp?id=<%=trim(rs("id"))%>">修改</a></td>
</tr>
<%
rs.movenext
next
%>
<tr>
<td colspan="6">
<table width="99%" border="1" cellpadding="2" bgcolor="#ffcccc" cellspacing="2" borderColorLight="#808080" borderColorDark="#ffffff">
<tr>
<%if rs.pagecount > 0 then%>
<td width="23%" align="left">当前页<font color="#ff0000"><%=intpage%></font>/<%=rs.PageCount%>   <%=rs.PageSize%>篇/页 </td>
<%else%>
<td width="15%" align="left">当前页0/0</td><%end if%>
<td width="62%" align="right"> <a href="index.asp?page=1">首页</a>|
<%if pre then%>
<a href="index.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="index.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
<a href="index.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="index.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="index.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
</td>
</tr>
<%
rs.close
set rs=nothing
%>
</table>
回复
moffatt 2004-12-05
回复
dachangtui 2004-12-05
很简单的嘛
楼主搜索一下"分页"就能找到答案了
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-12-05 11:18
社区公告
暂无公告