ASP分页显示

< !DOCTYPE HTML  PUBLIC   " -//W3C//DTD HTML 4.01 Transitional//EN "
" http://www.w3.org/TR/html4/loose.dtd " >
< html >
< head >
< meta http - equiv = " Content-Type "  content = " text/html; charset=gb2312 " >
< title > asp分页显示 </ title >
</ head >

< body >
< %
dim  i,intPage,page,pre,last,filepath

set  Conn = Server.CreateObject( " ADODB.Connection " )
Conn.Open 
" Provider=SQLOLEDB.1;Data Source=(local);user id=sa;password=;initial catalog=ncwm "
Set  rs  =  Server.CreateObject( " ADODB.RecordSet " )
Sql 
=   " select * from wmdw "
rs.PageSize 
=   5 ' 这里设定每页显示的记录数
rs.CursorLocation  =   3
rs.Open Sql,Conn,
1 , 1
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
%
>
循环体开始:
< table width = " 550 "  border = " 0 "  cellspacing = " 0 "  cellpadding = " 0 "  align = " center " >
< tr >
      
< td >< table width = " 550 "  border = " 0 "  cellspacing = " 0 "  cellpadding = " 0 "  align = " center "   class="tblMain">
          
<tr>
            
<td class="tdHeadLeft" nowrap width="42%">单位名称</td>
            
<td class="tdHead" nowrap width="22%">时间</td>
            
<td class="tdHead" nowrap width="12%">浏览</td>
            
<td class="tdHead" nowrap width="8%">状态</td>
            
<td class="tdHead" nowrap width="8%">附件</td>
            
<td class="tdHead" nowrap width="8%">删除</td>
          
</tr>
<
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%
>

           
<tr>
            
<td class="tdBodyLeft"><%=rs("Caption")%></td>
            
<td class="tdBody">&nbsp;<%=rs("IssueTime")%></td>
            
<td class="tdBody"><a href="#">浏览</a></td>
            
<td class="tdBody"><font style="{cursor:hand}"><%=rs("Status")%></font></td>
            
<td class="tdBody"><a href="#"><img src="../Images/FuJian.gif" border="0" width="15" height="15"></a></td>
            
<td class="tdBody">删除</td>
          
</tr>


<
rs.movenext
next
%
>
</table>
循环体结束
分页部分:
<table width="99%" border="1" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td width="11%" align="left">当前页0/0</td><%end if%>
<td width="76%" align="right"> <a href="fenye02.asp?page=1">[首页]</a>
<%if pre then%>
<a href="fenye02.asp?page=<%=intpage -1%>">[上页]</a><%end if%>
<%if last then%>
<a href="fenye02.asp?page=<%=intpage +1%>">[下页]</a> |<%end if%>
<a href="fenye02.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="fenye02.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="fenye02.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%
>
</select></font> 
</td>
</tr>
</table>

</body>
</html>
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值