⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 news_body.asp

📁 ASP源码
💻 ASP
字号:
<%sub news_body()
dim totalnews,Currentpage,totalpages,i
opennews
sql="select news_id,news_title,news_date from news order by news_date DESC"
if request("type")=1 then
sql="select top 10 news_id,news_title,news_date from news order by news_date DESC"
elseif request("type")=2 then
sql="select news_id,news_title,news_date from news order by news_date DESC"
elseif request("type")=3 then
sql="select news_id,news_title,news_date from news order by news_date ASC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr> 
    <td colspan="3" height="10" width="760"></td>
  </tr>
  <tr> 
    <td width="549" valign="top"> 
      <div align="center">
        <center>
        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="96%" id="AutoNumber1">
          <tr>
            <td width="100%" style="border-style: none; border-width: medium">
            <img border="0" src="images/pic000/t002news.gif"></td>
          </tr>
          <tr>
            <td width="100%" style="border-style: none; border-width: medium"> </td>
          </tr>
        </table>
        </center>
      </div>
      <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td class="chinese">
            <%if request("type")=1 then%>
            最新的10篇新闻
            <%else%>
            共有<span class="newshead"><%=rs.recordcount%></span>篇新闻
            <%end if%>
          </td>
        </tr>
      </table>
      <div align="center">
        <center>
      <table width="96%" border="1" cellspacing="0" cellpadding="3" bgcolor="#FFFFFF" bordercolor="#C0C0C0" style="border-collapse: collapse">
        <tr> 
          <td bgcolor="#e7e3e7" width="73%" align="center" class="chinese" height="22" background="images/pic000/c005.jpg">新闻列表</td>
          <td bgcolor="#e7e3e7" width="27%" align="center" class="chinese" background="images/pic000/c005.jpg">更新时间</td>
        </tr>
        <%
if not rs.eof then
rs.movefirst
rs.pagesize=newsperpage
if trim(request("page"))<>"" then
   currentpage=clng(request("page"))
   if currentpage>rs.pagecount then
      currentpage=rs.pagecount
   end if
else
   currentpage=1
end if
   totalnews=rs.recordcount
   if currentpage<>1 then
       if (currentpage-1)*newsperpage<totalnews then
	       rs.move(currentpage-1)*newsperpage
		   dim bookmark
		   bookmark=rs.bookmark
	   end if
   end if
   if (totalnews mod newsperpage)=0 then
      totalpages=totalnews\newsperpage
   else
      totalpages=totalnews\newsperpage+1
   end if
i=0
do while not rs.eof and i<newsperpage
%>
        <tr> 
          <td bgcolor="#FFFFFF" width="73%" height="22" class="chinese"><a href="shownews.asp?news_id=<%=rs("news_id")%>" target="_blank"><%=rs("news_title")%></a></td>
          <td bgcolor="#FFFFFF" width="27%" class="chinese" align="center"><%=rs("news_date")%> </td>
        </tr>
        <%
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
%>
        <tr> 
          <td bgcolor="#FFFFFF" colspan="2" height="22" align="center" class="chinese">当前没有新闻!</td>
        </tr>
        <%end if
end if%>
      </table>
        </center>
      </div>
      <%if not request("type")=1 then%>
      <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center" class="chinese">
        <form name="form1" method="post" action="news.asp">
          <tr> 
            <td align="right"> <%=currentpage%> /<%=totalpages%>页,<%=totalnews%>条记录/<%=newsperpage%>篇每页. 
              <%
i=1
showye=totalpages
if showye>10 then
showye=10
end if
for i=1 to showye
if i=currentpage then
%>
              <%=i%> 
              <%else%>
              <a href="news.asp?page=<%=i%>"><%=i%></a> 
              <%end if
next
if totalpages>currentpage then
if request("page")="" then
page=1
else
page=request("page")+1
end if%>
              <a href="news.asp?page=<%=page%>" title="下一页">>></a> 
              <%end if%>
              &nbsp;&nbsp;&nbsp;&nbsp; 
              <input type="text" name="page" class="textarea" size="4">
              <input type="submit" name="Submit" value="Go" class="button">
            </td>
          </tr>
        </form>
      </table>
      <%end if%>
      <br>
      <br>
    </td>
    <td width="7" background="images/dotlinev.gif"></td>
    <td width="204" align="center" valign="top"> 
      <table width="90%" border="0" cellspacing="0" cellpadding="8" bgcolor="#FFFFFF" class="chinese" style="border-width: 0; border-collapse:collapse" bordercolor="#111111">
        <tr> 
          <td bgcolor="#F5F5F5" width="84%" align="right" style="border-style: none; border-width: medium"> 
            <P style="LINE-HEIGHT: 150%"><a href="?type=1">最新的10篇新闻</a><br>
              <a href="?type=2">按时间降序排列</a><br>
              <a href="?type=3">按时间升序排列</a></p>
          </td>
        </tr>
      </table>
      <table class="chinese" cellSpacing="0" cellPadding="5" width="85%" align="center" border="0" height="1">
        <tr>
          <td class="chinese" align="right" height="16"></td>
        </tr>
        <tr>
          <td class="chinese" align="right" height="1">
          <p style="LINE-HEIGHT: 150%" align="center"><strong>
          <font color="#666666">本 站 声 明</font></strong></td>
        </tr>
        <tr>
          <td align="right" height="1">
          <div align="left">
            <font color="#999999">
              本站的大部分资料,文章都来自网上收集,其版权归作者本人所有,如果有任何侵犯您权益的地方,请联系我<span lang="zh-cn">们</span>,我<span lang="zh-cn">们</span>将马上进行整理,谢谢。 
            </font>
          </div>
          </td>
        </tr>
      </table>
      <p> </td>
  </tr>
  <tr> 
    <td colspan="3" background="images/dotlineh.gif" height="1" width="760"></td>
  </tr>
</table>
<%
rs.close
set rs=nothing
end sub%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -