📄 readnews.asp
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="inc_Conn.asp" -->
<%
Dim strSql,strNewsID,strContent
strNewsID=trim(Request.QueryString("NewsID"))
If strNewsID="" Then strNewsID=0
strSql="Select * from News where NewsID=" & strNewsID
set rs=MyCon.execute(strSql)
If not rs.eof Then
strClick=rs("News_Click")+1
strSql="Update News set News_Click=" & "'" & strClick & "'"
strSql=strSql & "where NewsID=" & strNewsID
If session("Click")<>rs("NewsID") Then MyCon.execute(strSql)
session("Click")=rs("NewsID")
End If
strSql="Select * from Class order by Class_Desc"
set rs1=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 rs.eof Then %>
<%=rs("News_Title")%>
<% Else %>
出错啦!!!
<% End If %>
</title>
<link rel="stylesheet" href="css.css" type="text/css">
</head>
<body>
<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>
<div align="center">
<center>
<table border="0" width="755">
<tr>
<td width="100%" align="left" bgcolor="#6699FF">
<a href="" Class=title1>首页</a><b><font color="#FFFFFF"> |</font></b>
<% Do while not rs1.eof %>
<a href="ListNews.asp?ClassID=<%=rs1("ClassID")%>" Class=title1><%=rs1("Class_Name")%></a>
<b><font color="#FFFFFF"> |</font></b>
<% rs1.movenext %>
<% Loop %>
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755">
<tr>
<td width="212" valign="top" align="left" bgcolor="#F5F5F5">
<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>
<% rs1.movefirst %>
<% Do while not rs1.eof %>
<option value="<%=rs1("ClassID")%>"><%=rs1("Class_Name")%></option>
<% rs1.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" align="center"><font class="title1">...新闻相关图片...</font></td>
</tr>
<%
strSql="SELECT * from News where (NewsID=" & strNewsID
strSql=strSql & " and News_Image>0)"
strSql=strSql & " order by NewsID Desc"
set rs2=MyCon.execute(strSql)
%>
<% If not rs2.eof Then %>
<%
for i=1 to rs2("News_Image")
strImageName=rs2("NewsID") & "_" & i
%>
<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>
<% Next %>
<% Else %>
<tr>
<td width="100%">
<div align="center">
该新闻没有图片,请在这里放广告.
</div>
</td>
</tr>
<% End If %>
</table>
</td>
<td width="515" valign="top" align="left">
<% If not rs.eof Then %>
<br>
<div align="center"><b><%=rs("News_Title")%></b></div>
<br>
<div align="center" class="title6">
作者:<%=rs("News_Author")%> <%=rs("News_Post_Time")%> 已读:<%=rs("News_Click")%>次
</div>
<br>
<%
strContent=Replace(trim(rs("News_Content")),chr(13)&chr(10),"<br>",1,-1,1)
strContent=Replace(strContent," "," ",1,-1,1)
strContent=Replace(strContent,"[image]","",1,-1,1)
%>
<div align="left"> <%=strContent%></div>
<% Else %>
<div align="center"><b>这条新闻不存在或者已经被删除!!!</b></div>
<% End If %>
</td>
<td width="22" valign="top" align="left"></td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755" bgcolor="whitesmoke">
<tr>
<td width="100%" align="right" class="title6">
<% If not rs.bof Then rs.movefirst %>
<% Do while not rs.eof %>
本新闻来自:<a href="<%=rs("News_Link")%>" class="title6" target="_blank"><%=rs("News_Freind")%></a>
<% rs.movenext %>
<% Loop %>
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755">
<tr>
<td width="100%">
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%
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 + -