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

📄 news_body.asp

📁 不错的asp论坛,大家可以看看啊和呵呵.
💻 ASP
字号:
<%sub news_body()
dim totalnews,Currentpage,totalpages,i
sql="select news_id,news_title,news_date from news order by news_date DESC"
if 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 bgcolor="#000000" align=center border=1 cellPadding=0 cellSpacing=0 width=760 borderColor="<%=border%>" frame=vsides rules=none>
<TBODY>
<TR>
<td height="24" align="right">
&nbsp;<img src=img/none.gif border=0><img src=img/link2.gif border='0'>&nbsp;<a href="?type=2">按时间降序排列</a>&nbsp;<img src=img/none.gif border=0><img src=img/link2.gif border='0'>&nbsp;<a href="?type=3">按时间升序排列</a>&nbsp;&nbsp;
 </TD>
</TR>
<TR>
<TD width="760" background="img/menu_bg2.gif" height="4"></TD>
</TR>
</TBODY>
</TABLE>
<TABLE align=center border=1 cellPadding=0 cellSpacing=0 width=760 borderColor="<%=border%>" frame=vsides rules=none>
<TBODY>
<TR>
<td width=204 align=left vAlign=top background=img/left_bg.gif>
<TABLE width=100% border=0 align=center cellPadding=0 cellSpacing=0>
<TBODY>
<TR><td width=204><img src=img/left_top.gif usemap="#Map" border="0"><map name="Map"><area shape="rect" coords="41, 11, 67, 24" href="book.asp" title="留言本"><area shape="rect" coords="106, 8, 169, 30" href="../ryxs/Default.asp" title="流星情缘纯文学网站"></map></td></tr>
</table>
<TABLE width=196 border=0 align=left cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<td align=center height="34" background="img/left01.gif"><strong><font color="#008000">流星新闻</font></strong></td>  
</tr>
<TR>
<td><font color="#008000"><%call br%>  </font><font color="#008000">一</font><font color="#008000">片羽毛、一声柳哨、一个会心的微笑、一丝温馨的祝福、一束期待的目光。相信自己,多给自己一点掌声,让心灵充满阳光。流星情缘新闻动态,将让费解的生活变的更精彩,更自由!</font></td>
</tr>
</table>
</TD>
<td width=1 height="190" background="img/xu.gif"></TD>
<td width=553 align=left vAlign=top bgcolor="#000000"><%call br%>
<table width='530' height="25" border='0' align="center" cellpadding='2' cellspacing='0' background="img/mainbg.gif">
              <tr> 
                <td>&nbsp;&nbsp;<img src="img/biao.gif" align="absmiddle">&nbsp;        
            <%if request("type")=1 then%>
            <font color=#ffffff>最新的10篇新闻        
            <%else%>
            共有<span class="newshead"><%=rs.recordcount%></span>篇新闻</font>        
            <%end if%></td>      
</tr>
</table>
      <table width="530" border="1" align="center" cellspacing="0" cellpadding="3" bgcolor="#000000" bordercolor="#333333" style="border-collapse: collapse">
        <tr> 
          <td bgcolor="#333333" width="73%" align="center" height="22">新闻列表</td>
          <td bgcolor="#333333" width="27%" align="center">更新时间</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 width="73%" height="22">&nbsp;<img src=img/none.gif border=0><img src=img/i4.gif border='0'>&nbsp;<a href="javascript:news('shownews.asp?news_id=<%=rs("news_id")%>')">
<%=left(rs("news_title"),30) & "..."%>
</a></td>
          <td width="27%" align="center"><%=rs("news_date")%> </td>
        </tr>
        <%
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
%>
        <tr> 
          <td colspan="2" height="22" align="center">当前没有新闻!</td>
        </tr>
        <%end if
end if
if not request("type")=1 then%>
<form name="form1" method="post" action="news.asp">
<tr> 
<td align="right" bgcolor="#333333" colspan="2">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR> 
<TD align=middle width="35%" height=25><IMG height=14 src="img/cha.gif" width=14 align=absMiddle> 共[<font color="#66ffff"><%=totalnews%></font>]篇新闻 分[<font color="#66ffff"><%=totalpages%></font>]页</TD>
<TD width="40%" align=middle bgcolor="#333333"><IMG height=11 src="img/lt.gif" width=11 align=absMiddle>
<%
if CurrentPage<2 then
response.write "<font color='669999'>首页 上一页</font> "
else
response.write "<a href=news.asp?page=1>首页</a> "
response.write "<a href=news.asp?page="&CurrentPage-1&">上一页</a> "
end if
if totalpages-currentpage<1 then
response.write "<font color='669999'>下一页 尾页</font>"
else
response.write "<a href=news.asp?page="&(CurrentPage+1)
response.write ">下一页</a> <a href=news.asp?page="&totalpages&">尾页</a>"
end if
%>
 <IMG height=11 src="img/gt.gif" width=11 align=absMiddle></TD>
<form name="form1" method="post" action="news.asp">
<TD align=middle width="25%">
<select name="page" class="lanyu">
<%
i=1
for i=1 to totalpages
if i=currentpage then
%>
<option value=<%=i%> selected>第<%=i%>页</option> 
<%else%>
<option value=<%=i%>>第<%=i%>页</option> 
<%end if
next%>
</select><input type="submit" name="Submit2" value="转向" class="button"> </TD>
</TR>
</FORM>
</TABLE>          
</td>
          </tr>
        </form>
      </table>
      <%end if%>
      <br>
      <br>
    </TD>
</TR>
</TBODY>
</TABLE>
<%
rs.close
set rs=nothing
end sub%>

⌨️ 快捷键说明

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