📄 listnews.asp
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="inc_Conn.asp" -->
<%
Dim strSql,strClassID,strPageNum,strTotalPages
Dim strRecordNum,strRecordPerPage
strClassID=trim(Request.QueryString("ClassID"))
If strClassID="" Then strClassID=0
strSql="Select * from Class order by Class_Desc"
set rs=MyCon.execute(strSql)
strPageNum=trim(Request.QueryString("PageNum"))
If strPageNum="" or strPageNum="0" Then strPageNum="1"
strPageNum=CInt(strPageNum)
RecordPerPage=50
set rs1=Server.CreateObject("ADODB.Recordset")
strSql="Select * from News where News_Class="
strSql=strSql & strClassID
strSql=strSql & " order by NewsID Desc"
rs1.CursorType = adOpenStatic
rs1.CacheSize = RecordPerPage
rs1.Open strSql,MyCon,1,1
rs1.PageSize = RecordPerPage
strTotalPages = rs1.PageCount
If Not(rs1.EOF) Then
rs1.AbsolutePage = strPageNum
End If
strSql="Select * from Class where ClassID=" & strClassID
set rs2=MyCon.execute(strSql)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>
<% If not rs2.eof Then %>
<%=rs2("Class_Name")%>
<% Else %>
错误!!!
<% End If %>
</title>
<link rel="stylesheet" href="css.css" type="text/css">
</head>
<body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755">
<tr>
<td width="214"><font face>
<table align="center" border="0" cellPadding="0" cellSpacing="0" width="10%">
<tbody>
<tr>
<td vAlign="top" width="50%"><img alt="中南学子" border="0" src="IMAGES/0001.gif"></td>
</tr>
</tbody>
</table>
</font></td>
<td width="281"></td>
<td width="254"></td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" width="755">
<tr>
<td width="100%" align="left" bgcolor="#6699FF">
<a href="Index.asp" Class="title1">首页</a><font color="#FFFFFF"> <b> |</b>
</font>
<% Do while not rs.eof %>
<a href="ListNews.asp?ClassID=<%=rs("ClassID")%>" Class=title1><%=rs("Class_Name")%></a>
<b><font color="#FFFFFF"> |</font></b>
<% rs.movenext %>
<% Loop %>
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755">
<tr>
<td width="215" valign="top" align="left" bgcolor="whitesmoke">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<form method="POST" action="Search.asp?active=DoIt">
<table border="1" cellpadding="0" cellspacing="0" width="98%" bordercolorlight="#6699FF" bordercolordark="#6699FF">
<tr>
<td width="100%">标题:<input type="text" name="title" size="20"></td>
</tr>
<tr>
<td width="100%">范围:<select size="1" name="Class">
<option value="0">所有类别</option>
<% rs.movefirst %>
<% Do while not rs.eof %>
<option value="<%=rs("ClassID")%>"><%=rs("Class_Name")%></option>
<% rs.movenext %>
<% Loop %>
</select></td>
</tr>
<tr>
<td width="100%" align="center"><input type="submit" value=" 查 找 " name="search"></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td width="100%"></td>
</tr>
<tr>
<td width="100%" bgcolor="#6699FF"><font Class="title1">...本专题热点新闻...</font></td>
</tr>
<tr>
<td width="100%">
<%
strSql="SELECT top 10 * from News where News_Class=" & strClassID
strSql=strSql & " order by News_Click Desc"
set rs3=MyCon.execute(strSql)
%>
<% Do while not rs3.eof %>
<a href="ReadNews.asp?NewsID=<%=rs3("NewsID")%>"><%=rs3("News_Title")%></a>
(<%=rs3("News_Click")%>)
<br>
<% rs3.movenext %>
<% Loop %>
</td>
</tr>
</table>
</td>
<td width="336" valign="top" align="center">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="96%">
<tr>
<td width="100%" valign="top" align="left">
<%
For strRecordNum = 1 to rs1.PageSize
If not rs1.eof Then
%>
<a href="ReadNews.asp?NewsID=<%=rs1("NewsID")%>"><%=rs1("News_Title")%></a>
(<%=rs1("News_Click")%>)
<br>
<%
Else
Call My_Back()
Exit For
End If
rs1.movenext
Next
%>
<% Sub My_Back() %>
<% If rs1.bof and rs1.eof Then %>
<div align="center" class="err">
这个类别不存在!!!
<br>
或者该类的新闻为空!
<br><br>
如果你认为这是一个错误的"错误信息",
<br>
请与
<a href="Administrator.asp?ClassID=<%=strClassID%>">管理员</a>
联系.
</div>
<% End If %>
<% End Sub %>
</td>
</tr>
<tr>
<td width="100%" valign="top" align="left">
</td>
</tr>
</table>
</center>
</div>
</td>
<td width="198" valign="top" align="left" bgcolor="#F5F5F5">
<table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#C0C0C0" bordercolordark="#6699FF">
<tr>
<td width="100%"></td>
</tr>
<tr>
<td width="100%" bgcolor="#6699FF" align="center"><font class="title1">...本专题图片新闻...</font></td>
</tr>
<%
strSql="SELECT top 5 * from News where (News_Class=" & strClassID
strSql=strSql & " and News_Image>0)"
strSql=strSql & " order by NewsID Desc"
set rs4=MyCon.execute(strSql)
%>
<% Do while not rs4.eof %>
<%
strImageName=rs4("NewsID") & "_" & "1"
%>
<tr>
<td width="100%"><div align="center"><a href="ReadImages.asp?ImageName=<%=strImageName%>" target="_blank"><img border="0" src="tools/Images/<%=strImageName%>.jpg" width="180" height="120"></a></div></td>
</tr>
<tr>
<td width="100%"><div align="center"><a href="ReadNews.asp?NewsID=<%=rs4("NewsID")%>"><%=rs4("News_Title")%></a></div></td>
</tr>
<% rs4.movenext %>
<% Loop %>
</table>
</td>
</tr>
</table>
</center>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="755" align="center">
<tr>
<td width="749" valign="top" align="left" bgcolor="#F5F5F5">
<div align="center" class="page">
共<%=strTotalPages%>页
第<%=strPageNum%>页
<% For i=1 to strTotalPages %>
<a href="ListNews.asp?ClassID=<%=strClassID%>&PageNum=<%=i%>"><%=i%></a>
<% Next %>
</div>
</td>
</tr>
</table>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755">
<tr>
<td width="100%" align="right"><img border="0" src="IMAGES/logo_3rom_by.gif" alt="又要考试了,真累人啊!"></td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%
rs4.close
set rs4=nothing
rs3.close
set rs3=nothing
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
rs.close
set rs=nothing
MyCon.close
set MyCon=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -