📄 news.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="top.asp"-->
<title>本班公告</title>
<body topmargin="0" background="images/bg.gif">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="759" height="49" style="border-left: 1 solid #000080; border-right: 1 solid #000080">
<tr>
<td height="25" width="745" colspan="3" style="border-bottom: 1 dotted #000080">
<p align="center"><font color="#FF0000">会计电算化40215班专用公告板,欢迎大家畅所欲言,这里在咱们自己的家园!</font></td>
</tr>
</center>
<tr>
<%
dim MaxPerPage
dim sql
dim totalPut
dim CurrentPage
dim TotalPages
if not isempty(request("page")) then
currentPage=cint(request("page"))
'当前页
else
currentPage=1
end if
sql="select * from news order by time DESC"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
<td width="745" colspan="3">
<br><p aligh="center" align="center"><font color="#ff0000">现在还没有任何公告!</font>
<br><br><a href="writenews.asp">我要发言</a></p>
<% else %>
<% rs.pagesize=15
totalput=rs.recordcount
'记录总数
totalpages=rs.pagecount
'总页数
maxperpage=rs.pagesize
'每页最大记录数
if currentpage<1 then
currentpage=1
end if
if currentpage>totalpages then
currentpage=totalpages
end if
if currentPage=1 then
showContent
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%
sub showContent
dim i
dim k
k=(totalPut-MaxPerPage*(currentPage-1))+1
i=0
do while not (rs.eof or err)
k=k-1
%> <td height="1" width="8">
<p align="left"></td>
</tr>
<center>
<tr>
<td height="16" width="745" colspan="3"></td>
</tr>
<tr>
<td height="16" width="15"></td>
</center>
<td height="16" width="711">
<p align="left"><%=trim(rs("news"))%></td>
<center>
<td height="16" width="20"></td>
</tr>
</center>
<tr>
<td height="1" width="745" colspan="3">
<p align="right">发表人:<font color=#ff0000><%=trim(rs("name"))%></font> 发表时间:<font color=#ff0000><%=trim(rs("time"))%></font> <a href="writenews.asp">我要发表</a></td>
</tr>
<center>
<tr>
<td height="1" width="745" colspan="3"></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
'当页记录数大于最大记录数时退出
rs.movenext
loop
end sub
%>
</center>
<tr>
<td height="16" width="745" colspan="3">
<p align="right">
<% if currentpage<1 then %>
<% else %>
<% showpages %>
<% end if %></td>
</tr>
</table>
</div>
</body>
<% end if %>
<!--#include file="down.asp"-->
<%
sub showpages()
If currentPage <> 1 Then
Response.Write "<A HREF=news.asp>【第一页】</A> "
Response.Write "<A HREF=news.asp?Page=" & (currentPage-1) & ">【上一页】</A> "
End If
If currentPage <> totalpages Then
Response.Write "<A HREF=news.asp?Page=" & (currentPage+1) & ">【下一页】</A> "
Response.Write "<A HREF=news.asp?Page=" & totalPages & ">【最后一页】</A> "
Response.write "【共<font color=#ff0000>" & totalpages &"</font>页】"
End If
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -