| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 300 人关注过本帖
标题:请教ASP程序分页问题
取消只看楼主 加入收藏
rengangyi
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2006-8-13
收藏
 问题点数:0 回复次数:0 
请教ASP程序分页问题


<!--#include file="conn.asp"-->
<!--#include file="head.asp"-->
<style type="text/css">
body {
font-family: "宋体";
font-size:9pt;
background-color:#ffffff;
margin-left:0pt;
margin-top:0pt;
color: #FFFFFF;
}
td,input,select {font-family:宋体;font-size:9pt; color:#000000}

A:link,A:active,A:visited {text-decoration: none; color: #333333}
A:hover {text-decoration: underline; color:#b40000}


</style>
<table width="783" border="1" align="center" bordercolor="#336699">

<tr>
<td height="60%" align="center" valign="top">
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from adtable order by id desc",conn,1,1
if rs.eof and rs.bof then
response.write "<center><br><font color=red size=2>对不起,暂无广告!</font></font>"
'response.End
else
%>

<% dim shownum
shownum=20
totalrecord=rs.recordcount
rs.pagesize=shownum
maxpage=rs.pagecount

requestpage=clng(request.querystring("page"))

if requestpage="" or requestpage=0 then
requestpage=1
end if
if resquestpage>maxpage then
resquestpage=maxpage
end if

if not requestpage=1 then
rs.move (requestpage-1)*rs.pagesize
end if
for i=1 to rs.pagesize and not rs.bof%>
<table width="102%" height="45" border=0 align="left" cellpadding=0 cellspacing=0 class="central">
<%
dim i_1,i_count
i_1=int((rs.recordcount+1)/4)
if i_1>10 then
i_1=10
end if
'response.write i_1
for i_count=1 to i_1%>
<tr>
<td width="17%" valign=top><table width="85" cellpadding=0 cellspacing=0 >
<tr>
<td height="51" align="center"><table width="128" height="51" border="0">
<tr>
<td width="122" height="51" valign="middle" background="pic/ad.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<div align="center">
<%if rs("vip")="-1" then %><a href="view.asp?id=<%=rs("id")%>">
<%else%>
<%end if%>
<%=rs("adname")%><br />
<font colro="#663333">TEL:<%=rs("adtel")%></font><br />
<%rs.movenext%>
</a></div></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="17%" height="51" valign=top>
<table width="126" height="71" border="0">
<tr>
<td width="120" height="51" background="pic/ad.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<div align="center"><%if rs("vip")="-1" then %><a href="view.asp?id=<%=rs("id")%>">
<%else%>
<%end if%><%=rs("adname")%><br />
<font colro="#663333">TEL:<%=rs("adtel")%></font><br />
<%rs.movenext%>
</a></div></td>
</tr>
</table></td>
<td width="17%" height="51" valign=top>
<table width="126" height="51" border="0">
<tr>
<td width="120" height="51" background="pic/ad.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<div align="center"><%if rs("vip")="-1" then %><a href="view.asp?id=<%=rs("id")%>">
<%else%>
<%end if%><%=rs("adname")%><br />
<font colro="#663333">TEL:<%=rs("adtel")%></font><br />
<%rs.movenext%>
</a></div></td>
</tr>
</table></td>
<td width="17%" height="51" valign=top>
<table width="126" height="51" border="0">
<tr>
<td height="51" background="pic/ad.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<div align="center"><%if rs("vip")="-1" then %><a href="view.asp?id=<%=rs("id")%>">
<%else%>
<%end if%><%=rs("adname")%><br />
<font colro="#663333">TEL:<%=rs("adtel")%></font><br />
<%rs.movenext%>
</a></div></td>
</tr>
</table></td>

<td width="16%" height="45" valign=top>
<table width="120" height="45" border="0">
<tr>
<td height="51" background="pic/ad.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<div align="center"><%if rs("vip")="-1" then %><a href="view.asp?id=<%=rs("id")%>">
<%else%>
<%end if%><%=rs("adname")%><br />
<font colro="#663333">TEL:<%=rs("adtel")%></font><br />
<%rs.movenext%>
</a></div></td>
</tr>
</table></td>
<td width="16%" height="45" valign="top" >
<%if rs.eof then%>
<%else%>
<table width="120" height="45" border="0">
<tr>
<td height="51" background="pic/ad.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<div align="center"><%if rs("vip")="-1" then %><a href="view.asp?id=<%=rs("id")%>">
<%else%>
<%end if%><%=rs("adname")%><br />
<font colro="#663333">TEL:<%=rs("adtel")%></font><br />
<%rs.movenext%>
</a></div></td>
</tr>
</table>
<%end if%></td>
</tr>
<%next%>
<%
rs.close
set rs=nothing%>
</table>
<%end if%></td>
</tr>

</table>
<table width="783" height="10" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#336699" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" >
<tr>
<td align=center>
<span >
<%
if requestpage-1 mod 10=0 then
p=(requestpage-1) \ 10
else
p=(requestpage-1) \ 10
end if
if requestpage=1 then
response.write "<font face=webdings color=""#FF0000"">9</font>"
else
response.write "<a href=list.asp?page=1 title=首页><font face=webdings>9</font></a>"
end if
if p*10>0 then response.write "<a href=list.asp?page="&p*10&" title=上十页><font face=webdings>7</font></a>"
response.write "<b>"
for ii=p*10+1 to P*10+10
if ii=requestpage then
response.write "<font color=""#FF0000"">"&ii&"</font> "
else
response.write "<a href=list.asp?page="&ii&">"&ii&"</a> "
end if
if ii=maxpage then exit for
next
response.write "</b>"
if ii<maxpage then response.write "<a href=list.asp?page="&ii&" title=下十页><font face=webdings>8</font></a>"
if requestpage=maxpage then
response.write "<font face=webdings color=""#FF0000"">:</font> "
else
response.write "<a href=list.asp?page="&maxpage&" title=尾页><font face=webdings>:</font></a>"
end if
response.write" 总共有"&maxpage&"页 共"&totalrecord&"个记录 每页"&shownum&"个"

%>
</span></td>
</tr>
</TABLE>

<!--#include file="foot.asp"-->

搜索更多相关主题的帖子: ASP 
2006-08-15 23:49
快速回复:请教ASP程序分页问题
数据加载中...
 
   



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

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