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

📄 category.asp

📁 源代码简介: 即时添加
💻 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, curcate, strcate

if request("cate") = "" then
	curcate="0"
else
	curcate = request("cate")

	'显示专题信息
	sql = "SELECT title FROM category WHERE id=" + cstr(curcate)
	set rs=conn.execute(sql)
	strcate=rs("title")
	rs.close

 %>

<html>
<head>
	<title><%= strcate %></title>
<meta HTTP-EQUIV="Content-cate" 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>
</head>

<body bgcolor=<%=BGCOLOR%>>
<!--#include file="header.htm"-->
<%
if request("page")="" then
  	curpage = 1
else
	curpage = cint(request("page"))
end if
 
sql = "SELECT * FROM news WHERE cateid=" + cstr(curcate) + " 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='100%' colspan=3 height=20><center><font color=ffffff size=2>" + strcate + "</font></td></tr>"
		response.write "<tr bgcolor=#F1DAB1><td width='70%' height=15>&nbsp;==&nbsp;新&nbsp;闻&nbsp;标&nbsp;题&nbsp;==</td><td width='20%' height=15><center>日期</td><td width='10%' height=15><center>点击</td></tr>"
		for i = 1 to rs.pagesize
			response.write "<tr bgcolor=#F7E8D0><td><font color=#336699>&nbsp;●&nbsp;</font><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 "<tr bgcolor=#F1DAB1><td width='100%' height=15 colspan=3><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='category.asp?page=1&cate=" + cstr(curcate) + "'>首页</a> <a href='category.asp?page=" + cstr(curpage-1) + "&cate=" + cstr(curcate) + "'>上一页</a> "
		end if
		if  curpage = rs.pagecount then
			response.write "下一页 尾页"
		else
			response.write "<a href='category.asp?page=" + cstr(curpage+1) + "&cate=" + cstr(curcate) + "'>下一页</a> <a href='category.asp?page=" + cstr(rs.pagecount) + "&cate=" + cstr(curcate) + "'>尾页</a>"
		end if
							response.write "</td></tr></tr></td></table>"
		response.write "</table>"
		rs.close
 	end if	'if rs.bof and rs.eof then
end if	'if err.number <> 0 then
end if	'if request("cate") = "" then
set rs = nothing
call endconnection()

 %>
<!--#include file="footer.htm"-->

</body>
</html>

⌨️ 快捷键说明

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