求帮弄这个循环显示并分页显示

不太会asp
这是我的代码
<!--#include file="conn.asp"-->
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
#thebody {
height: 500px;
width: 870px;
}
#thebody_1 {
height: 200px;
width: 435px;
float: left;
}
#thebody_2 {
height: 200px;
width: 435px;
float: left;
}
#thebody_3 {
height: 200px;
width: 870px;
}
#thebody_1_0 {
background-color: #339900;
height: 30px;
width: 435px;
}
#thebody_1_1 {
height: 30px;
width: 250px;
background-color: #663399;
float: left;
}
#thebody_1_2 {
background-color: #CC6666;
height: 30px;
width: 150px;
float: right;
}
.thebody {
background-color: #00FFCC;
height: 30px;
width: 435px;
}
-->
</style>
</head>

<body>
<div id="thebody">
  <div id="thebody_1">
    <div id="thebody_1_0"><img src="images/Main_news_top.gif" width="160" height="17" /></div>
<%
set rs2news=server.createobject("adodb.recordset")
             sql="select * from News order by adddate desc"
                 rs2news.open sql,conn,1,1
 do while not rs.eof 
if rs2news.recordcount=0 then 

        


%>
<div class="thebody">暂无信息</div>


<%else%>

<%

   rs2news.PageSize =10 
iCount=rs2news.RecordCount 
iPageSize=rs2news.PageSize
     maxpage=rs2news.PageCount 
     page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs2news.AbsolutePage=Page

if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
%>




<div class="thebody">


  <div id="thebody_1_1">
<%=left(trim(rs2news("newsname")),15)%></div>
  <div id="thebody_1_2"> <%
response.write (year(rs2news("adddate")))
response.write "-"
addmonth="0"&month(rs2news("adddate"))
                           response.write right(addmonth,2)
                           %>-<%addday="0"&day(rs2news("adddate"))
                           response.write right(addday,2)
                           %></div>



         
  </div>
<%rs.movenext
loop%>
<%end if%>



  </div>
  <div id="thebody_2">此处显示  id "thebody_2" 的内容</div>
  <div id="thebody_3">此处显示  id "thebody_3" 的内容</div>
</div>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值