📄 main.asp
字号:
<% option explicit %>
<!--#include file="conn.asp"-->
<!--#include file="style.asp"-->
<html>
<head>
<title>新闻</title>
<meta HTTP-EQUIV="Content-topic" content="text/html; charset=gb2312">
<link rel="stylesheet" href="common.css">
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 9pt}
body { font-family: "宋体"; font-size: 9pt}
select { font-family: "宋体"; font-size: 9pt}
A {text-decoration: none; color: #336699; font-family: "宋体"; font-size: 9pt}
A:hover {text-decoration: underline; color: #FF0000; font-family: "宋体"; font-size: 9pt}
-->
</style>
<% dim rs, sql, rs1, sql1
set rs = server.createobject("adodb.recordset")
set rs1 = server.createobject("adodb.recordset")
%>
</head>
<body bgcolor=<%=BGCOLOR%>>
<!--#include file="header.htm"-->
<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="*" valign="TOP">
<%
'特别新闻
sql = "SELECT id,title,addtime FROM news WHERE special ORDER BY addtime DESC"
rs.open sql, conn, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
response.write "<table width='100%' bgcolor=#000000 cellspacing=0 cellpadding=0><td bgcolor=#000000><table width='100%' cellspacing=1 cellpadding=2><tr><td bgcolor=#F1DAB1>"
response.write " == 特别新闻 ==</td></tr>"
response.write "<tr><td bgcolor=#FEF7ED>"
if rs.bof and rs.eof then
rs.close
response.write "没有特别新闻"
else
response.write "<ul>"
dim i
for i = 1 to FIRSTNO
response.write "<li><a target='_self' href='shownews.asp?id=" + cstr(rs("id")) + "'>" + rs("title") + "(" + cstr(rs("addtime")) + ")</a>"
rs.movenext
if rs.eof then exit for
next
rs.close
response.write "</ul>"
end if
end if
response.write "<script src=http://www.on.net.cn/counter.asp?id=taiwe&style=0&length=0></script></tr></td></table>"
'新闻类别
sql = "SELECT * FROM category"
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
do while not rs.eof
response.write "<table width='100%' bgcolor=#000000 cellspacing=0 cellpadding=0><td bgcolor=#000000><table width='100%' cellspacing=1 cellpadding=2><tr><td bgcolor=#F1DAB1> == "
response.write rs("title") + " ==</td></tr>"
response.write "<tr><td bgcolor=#FEF7ED>"
'本类别新闻标题
sql1 = "SELECT id,title,addtime FROM news WHERE cateid=" + cstr(rs("id")) + " ORDER BY addtime DESC"
rs1.open sql1, conn, 1, 1
if err.number <> 0 then
response.write "数据库出错"
else
if rs1.bof and rs1.eof then
rs1.close
response.write "没有新闻"
else
response.write "<ul>"
for i = 1 to FIRSTNO
response.write "<li><a target='_self' href='shownews.asp?id=" + cstr(rs1("id")) + "'>" + rs1("title") + "(" + cstr(rs1("addtime")) + ")</a>"
rs1.movenext
if rs1.eof then exit for
next
rs1.close
response.write "</ul>"
end if
end if
response.write "<p align=right>"
response.write "<a target='_self' href='category.asp?cate=" + cstr(rs("id")) + "'>更多新闻...</a></p>"
response.write "</td></tr></table></td></table>"
rs.movenext
loop
rs.close
end if
end if
%>
</td></table>
<table width="100%" cellspacing="0" cellpadding="0">
<td width="100%" align="CENTER" valign="TOP" bgcolor="#000000">
<table width='100%' border="0" cellpadding="2" cellspacing="1">
<tr><td bgcolor=#F1DAB1 valign="middle">专题新闻</td></tr>
<tr><td bgcolor=#FEF7ED>
<%
'新闻专题
sql = "SELECT * FROM topic"
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
response.write "<ul>"
do while not rs.eof
response.write "<li><a target='_self' href='topic.asp?topic=" + cstr(rs("id")) + "'>" + rs("title") + "</a>"
rs.movenext
loop
response.write "</ul>"
rs.close
end if
end if
%>
</td></tr>
</table></table>
<%
set rs1 = nothing
set rs = nothing
call endconnection()
%>
<!--#include file="footer.htm"-->
</body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -