asp分页问题,求高手解答
发布网友
发布时间:2022-05-01 13:52
我来回答
共1个回答
热心网友
时间:2023-10-16 09:13
<body>
<!--#include file="inc/logotop.asp" -->
<!--#include file="inc/sys.asp"-->
<%
sub titlen(i)
tlen=rs("topic")
if len(tlen)>i then
tlen=left(tlen,i)&"..."
else
tlen=tlen
end if
end sub
'设置每页显示数量
Const PAGESIZE=8
'设置略显示多少页
Const PARTSIZE=10
dim tlen
tlen=""
AProctClass=trim(request("ProctClass"))
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
%>
<%
call checkform()
ProctClass=request("ProctClass")
ClassName=request("ClassName")
if proctclass = "" then
set rsc=conn.execute("select top 1 * from tproctclass where ver=0 order by sortno")
call DoError()
if not rsc.eof then
proctclass = rsc("classid")
classname = rsc("classname")
end if
rsc.close()
set rsc = nothing
end if
sql = "select * from tproct where ver=0 "
if ProctClass <> "" then
sql = sql & " and ProctClass="&cstr(ProctClass)
end if
sql = sql & " order by sortno"
rs.open sql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
if RS.EOF then
Response.Write("<center><font color=red>目前还没有内容</font>")
else
if recordcount > 0 then RS.AbsolutePage = page
call DoError()
%>
<!--#include file="inc/left_tel.asp" --></td>
</tr>
</tbody>
</table>
<p> </p></td>
<td width="619" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" bgcolor="#f1f1f1" class="td_nybt">
<img src="images/bullet_snav_cap.gif" width="12" height="12"> <%=classname%> </td>
</tr>
<tr>
<td height="1" bgcolor="#666666"></td>
</tr>
</table>
<br>
<TABLE width=94% height="117" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<%
for i = 1 to PAGESIZE
if RS.EOF then exit for
call titlen(listlen)
%>
<TR vAlign=middle align=left>
<TD height="115" align="left"><a href="proct_detail.asp?proctid=<%=rs("proctid")%>"><img src="proct/<%=rs("defaultpicurl")%>" width=152 height=140 border="0"></a></TD>
<% call DoError() %>
<TD><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="69%" height="22"><strong> <%=rs("proctname")%></strong></td>
<td width="31%"><a href="proct_detail.asp?proctid=<%=rs("proctid")%>"><img src="images/PRODUCT/title_news.gif" width="70" height="23" border="0"></a></td>
</tr>
<tr>
<td colspan="2" class="td1en"><%=rs("summary")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD width=28% height="1" bgcolor="#E2E7EA"></TD>
<TD width=72% height="1" bgcolor="#E2E7EA"></TD>
</TR>
<%
rs.movenext
next
rs.close
set rs = nothing
%>
</TBODY>
</TABLE>
<br>
<%if pagecount > 0 then
response.write("<table width=""95%"" align=center cellspacing=3 cellpadding=3><tr><td align=right>")
response.write("页次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每页<b>" & pagesize & "</b> 共<b>" & recordcount & "</b> 条:")
Spage = page mod PARTSIZE
if page > PARTSIZE then
if Spage = 0 then Spage = PARTSIZE
Spage = page - Spage + 1
else
Spage = 1
end if
Epage = Spage + PARTSIZE - 1
if Epage > pagecount then Epage = pagecount
if page > PARTSIZE then
response.write("<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & Spage - 1 & """>[<<]</a>")
end if
for i = Spage to Epage
if i = page then
response.write("[<font color=red><b>" & i & "</b></font>]")
else
response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & i & """>" & i & "</a>]")
end if
next
if Epage < pagecount then
response.write("<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & Epage + 1 & """>[>>]</a>")
end if
if Spage <> 1 then response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=1"">首页</a>]")
if Epage <> pagecount then response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & pagecount & """>尾页</a>]")
response.write("</td></tr></table><br>")
end if
rs.close
set rs=nothing
%>
</td>
<td width="1" bgcolor="#D6D6D6"></td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="inc/foot.asp" -->
</body>
</html>
<!--#include file="inc/kefu_index.asp"-->
<%
set rsss=nothing
set rss=nothing
set rs=nothing
set conn=nothing
%>
你自己测试一下,有问题给我留言。
热心网友
时间:2023-10-16 09:13
<body>
<!--#include file="inc/logotop.asp" -->
<!--#include file="inc/sys.asp"-->
<%
sub titlen(i)
tlen=rs("topic")
if len(tlen)>i then
tlen=left(tlen,i)&"..."
else
tlen=tlen
end if
end sub
'设置每页显示数量
Const PAGESIZE=8
'设置略显示多少页
Const PARTSIZE=10
dim tlen
tlen=""
AProctClass=trim(request("ProctClass"))
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
%>
<%
call checkform()
ProctClass=request("ProctClass")
ClassName=request("ClassName")
if proctclass = "" then
set rsc=conn.execute("select top 1 * from tproctclass where ver=0 order by sortno")
call DoError()
if not rsc.eof then
proctclass = rsc("classid")
classname = rsc("classname")
end if
rsc.close()
set rsc = nothing
end if
sql = "select * from tproct where ver=0 "
if ProctClass <> "" then
sql = sql & " and ProctClass="&cstr(ProctClass)
end if
sql = sql & " order by sortno"
rs.open sql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
if RS.EOF then
Response.Write("<center><font color=red>目前还没有内容</font>")
else
if recordcount > 0 then RS.AbsolutePage = page
call DoError()
%>
<!--#include file="inc/left_tel.asp" --></td>
</tr>
</tbody>
</table>
<p> </p></td>
<td width="619" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" bgcolor="#f1f1f1" class="td_nybt">
<img src="images/bullet_snav_cap.gif" width="12" height="12"> <%=classname%> </td>
</tr>
<tr>
<td height="1" bgcolor="#666666"></td>
</tr>
</table>
<br>
<TABLE width=94% height="117" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<%
for i = 1 to PAGESIZE
if RS.EOF then exit for
call titlen(listlen)
%>
<TR vAlign=middle align=left>
<TD height="115" align="left"><a href="proct_detail.asp?proctid=<%=rs("proctid")%>"><img src="proct/<%=rs("defaultpicurl")%>" width=152 height=140 border="0"></a></TD>
<% call DoError() %>
<TD><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="69%" height="22"><strong> <%=rs("proctname")%></strong></td>
<td width="31%"><a href="proct_detail.asp?proctid=<%=rs("proctid")%>"><img src="images/PRODUCT/title_news.gif" width="70" height="23" border="0"></a></td>
</tr>
<tr>
<td colspan="2" class="td1en"><%=rs("summary")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD width=28% height="1" bgcolor="#E2E7EA"></TD>
<TD width=72% height="1" bgcolor="#E2E7EA"></TD>
</TR>
<%
rs.movenext
next
rs.close
set rs = nothing
%>
</TBODY>
</TABLE>
<br>
<%if pagecount > 0 then
response.write("<table width=""95%"" align=center cellspacing=3 cellpadding=3><tr><td align=right>")
response.write("页次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每页<b>" & pagesize & "</b> 共<b>" & recordcount & "</b> 条:")
Spage = page mod PARTSIZE
if page > PARTSIZE then
if Spage = 0 then Spage = PARTSIZE
Spage = page - Spage + 1
else
Spage = 1
end if
Epage = Spage + PARTSIZE - 1
if Epage > pagecount then Epage = pagecount
if page > PARTSIZE then
response.write("<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & Spage - 1 & """>[<<]</a>")
end if
for i = Spage to Epage
if i = page then
response.write("[<font color=red><b>" & i & "</b></font>]")
else
response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & i & """>" & i & "</a>]")
end if
next
if Epage < pagecount then
response.write("<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & Epage + 1 & """>[>>]</a>")
end if
if Spage <> 1 then response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=1"">首页</a>]")
if Epage <> pagecount then response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & pagecount & """>尾页</a>]")
response.write("</td></tr></table><br>")
end if
rs.close
set rs=nothing
%>
</td>
<td width="1" bgcolor="#D6D6D6"></td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="inc/foot.asp" -->
</body>
</html>
<!--#include file="inc/kefu_index.asp"-->
<%
set rsss=nothing
set rss=nothing
set rs=nothing
set conn=nothing
%>
你自己测试一下,有问题给我留言。
热心网友
时间:2023-10-16 09:13
<body>
<!--#include file="inc/logotop.asp" -->
<!--#include file="inc/sys.asp"-->
<%
sub titlen(i)
tlen=rs("topic")
if len(tlen)>i then
tlen=left(tlen,i)&"..."
else
tlen=tlen
end if
end sub
'设置每页显示数量
Const PAGESIZE=8
'设置略显示多少页
Const PARTSIZE=10
dim tlen
tlen=""
AProctClass=trim(request("ProctClass"))
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
%>
<%
call checkform()
ProctClass=request("ProctClass")
ClassName=request("ClassName")
if proctclass = "" then
set rsc=conn.execute("select top 1 * from tproctclass where ver=0 order by sortno")
call DoError()
if not rsc.eof then
proctclass = rsc("classid")
classname = rsc("classname")
end if
rsc.close()
set rsc = nothing
end if
sql = "select * from tproct where ver=0 "
if ProctClass <> "" then
sql = sql & " and ProctClass="&cstr(ProctClass)
end if
sql = sql & " order by sortno"
rs.open sql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
if RS.EOF then
Response.Write("<center><font color=red>目前还没有内容</font>")
else
if recordcount > 0 then RS.AbsolutePage = page
call DoError()
%>
<!--#include file="inc/left_tel.asp" --></td>
</tr>
</tbody>
</table>
<p> </p></td>
<td width="619" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" bgcolor="#f1f1f1" class="td_nybt">
<img src="images/bullet_snav_cap.gif" width="12" height="12"> <%=classname%> </td>
</tr>
<tr>
<td height="1" bgcolor="#666666"></td>
</tr>
</table>
<br>
<TABLE width=94% height="117" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<%
for i = 1 to PAGESIZE
if RS.EOF then exit for
call titlen(listlen)
%>
<TR vAlign=middle align=left>
<TD height="115" align="left"><a href="proct_detail.asp?proctid=<%=rs("proctid")%>"><img src="proct/<%=rs("defaultpicurl")%>" width=152 height=140 border="0"></a></TD>
<% call DoError() %>
<TD><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="69%" height="22"><strong> <%=rs("proctname")%></strong></td>
<td width="31%"><a href="proct_detail.asp?proctid=<%=rs("proctid")%>"><img src="images/PRODUCT/title_news.gif" width="70" height="23" border="0"></a></td>
</tr>
<tr>
<td colspan="2" class="td1en"><%=rs("summary")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD width=28% height="1" bgcolor="#E2E7EA"></TD>
<TD width=72% height="1" bgcolor="#E2E7EA"></TD>
</TR>
<%
rs.movenext
next
rs.close
set rs = nothing
%>
</TBODY>
</TABLE>
<br>
<%if pagecount > 0 then
response.write("<table width=""95%"" align=center cellspacing=3 cellpadding=3><tr><td align=right>")
response.write("页次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每页<b>" & pagesize & "</b> 共<b>" & recordcount & "</b> 条:")
Spage = page mod PARTSIZE
if page > PARTSIZE then
if Spage = 0 then Spage = PARTSIZE
Spage = page - Spage + 1
else
Spage = 1
end if
Epage = Spage + PARTSIZE - 1
if Epage > pagecount then Epage = pagecount
if page > PARTSIZE then
response.write("<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & Spage - 1 & """>[<<]</a>")
end if
for i = Spage to Epage
if i = page then
response.write("[<font color=red><b>" & i & "</b></font>]")
else
response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & i & """>" & i & "</a>]")
end if
next
if Epage < pagecount then
response.write("<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & Epage + 1 & """>[>>]</a>")
end if
if Spage <> 1 then response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=1"">首页</a>]")
if Epage <> pagecount then response.write("[<a href=""?d_id="&d_id&"&ProctClass=" & AProctClass & "&page=" & pagecount & """>尾页</a>]")
response.write("</td></tr></table><br>")
end if
rs.close
set rs=nothing
%>
</td>
<td width="1" bgcolor="#D6D6D6"></td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="inc/foot.asp" -->
</body>
</html>
<!--#include file="inc/kefu_index.asp"-->
<%
set rsss=nothing
set rss=nothing
set rs=nothing
set conn=nothing
%>
你自己测试一下,有问题给我留言。