📄 topic.asp
字号:
<% option explicit %>
<!--#include file="conn.asp"-->
<!--#include file="style.asp"-->
<%
on error resume next
dim rs, sql
set rs = server.createobject("adodb.recordset")
dim curpage, curtopic, strtopic
if request("topic") = "" then
curtopic="-1"
else
curtopic = request("topic")
'显示专题信息
sql = "SELECT title FROM topic WHERE id=" + cstr(curtopic)
set rs=conn.execute(sql)
strtopic=rs("title")
rs.close
%>
<html>
<head>
<title><%= strtopic %></title>
<meta HTTP-EQUIV="Content-topic" content="text/html; charset=gb2312">
<link rel="stylesheet" href="common.css">
</head>
<body bgcolor=<%=BGCOLOR%>>
<!--#include file="header.htm"-->
<%
response.write "<p align=center>专题新闻:" + strtopic + "</p>"
if request("page")="" then
curpage = 1
else
curpage = cint(request("page"))
end if
sql = "SELECT * FROM news WHERE topicid=" + cstr(curtopic) + " ORDER BY addtime DESC"
rs.open sql, conn, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
if rs.bof and rs.eof then
rs.close
response.write "没有新闻"
else
dim i
rs.pagesize = PERPAGE
rs.absolutepage = curpage
response.write "<table border=0 width='100%' cellspacing=0 cellpadding=0><tr><td width='100%' bgcolor=#000000>"
response.write "<table width='100%' align=center cellspacing=1 cellpadding=2>"
response.write "<tr bgcolor=#336699><td width='70%'><font color=#ffffff>标题</font></td><td width='20%'><font color=#ffffff><center>日期</font></td><td width='10%'><font color=#ffffff><center>点击</font></td></tr>"
for i = 1 to rs.pagesize
response.write "<tr bgcolor=#D7E6FF><td><a target=_self href=shownews.asp?id=" + cstr(rs("id")) + ">" + rs("title") + "</a></td><td><center>" + formatdatetime(rs("addtime")) + "</td><td><center>" + cstr(rs("hits")) + "</td></tr>"
rs.movenext
if rs.eof then
i = i + 1
exit for
end if
next
response.write "</table></tr></td></table>"
response.write "<hr><p align=center>"
response.write "第" + cstr(curpage) + "页/总" + cstr(rs.pagecount) + "页 "
response.write "本页" + cstr(i-1) + "条/总" + cstr(rs.recordcount) + "条 "
if curpage = 1 then
response.write "首页 前页 "
else
response.write "<a href='topic.asp?page=1&topic=" + cstr(curtopic) + "'>首页</a> <a href='topic.asp?page=" + cstr(curpage-1) + "&topic=" + cstr(curtopic) + "'>前页</a> "
end if
if curpage = rs.pagecount then
response.write "后页 末页"
else
response.write "<a href='topic.asp?page=" + cstr(curpage+1) + "&topic=" + cstr(curtopic) + "'>后页</a> <a href='topic.asp?page=" + cstr(rs.pagecount) + "&topic=" + cstr(curtopic) + "'>末页</a>"
end if
rs.close
end if 'if rs.bof and rs.eof then
end if 'if err.number <> 0 then
end if 'if request("topic") = "" then
set rs = nothing
call endconnection()
%>
<!--#include file="footer.htm"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -