📄 search.asp
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="inc_Conn.asp" -->
<%
Dim strSql,strActive,strTitle,strClass
strSql="Select * from Class order by Class_Desc"
set rs=MyCon.execute(strSql)
strActive=trim(Request.QueryString("active"))
%>
<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>关键字查找</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">
<b><a href="Index.asp" Class="title1">首页</a><font color="#FFFFFF"> |</font></b>
<% 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%" valign="top" align="left">
</td>
</tr>
<tr>
<td width="100%" valign="top" align="left"></td>
</tr>
<tr>
<td width="100%" valign="top" align="left"></td>
</tr>
<tr>
<td width="100%" valign="top" align="left"></td>
</tr>
</table>
</td>
<td width="437" 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">
<%
If strActive="DoIt" Then
strTitle=trim(Request.form("title"))
strClass=trim(Request.form("Class"))
If strTitle="" Then strTitle="www.3rom.com"
set rs1=server.CreateObject("ADODB.RecordSet")
If strClass=0 Then
strSql="Select * from News where News_Title like"
strSql=strSql & " '%" & strTitle & "%'"
strSql=strSql & " order by NewsID Desc"
Else
strSql="Select * from News where (News_Title like"
strSql=strSql & " '%" & strTitle & "%'"
strSql=strSql & " and News_Class=" & strClass & ")"
strSql=strSql & " order by NewsID Desc"
End If
rs1.Open strSql,MyCon,1,1
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<% If not rs1.eof Then %>
关键字:<font color="red"><%=strTitle%></font>
找到<%=rs1.RecordCount%>条相关新闻
<% Else %>
找不到您想要的内容,请使用<a href="Search.asp?active=Admin">高级查找</a>功能试试.
<% End If %>
</td>
</tr>
<% Do while not rs1.eof %>
<tr>
<td width="100%">
<a href="ReadNews.asp?NewsID=<%=rs1("NewsID")%>"><%=rs1("News_Title")%></a>
<br>
</td>
</tr>
<% rs1.movenext %>
<% Loop %>
<tr>
<td width="100%" valign="top" align="center">123</td>
</tr>
</table>
<%
rs1.close
set rs1=nothing
End If
%>
</td>
</tr>
<tr>
<td width="100%" valign="top" align="center">
<% If strActive="Admin" Then %>
<form method="POST" action="Search.asp?active=Check">
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#6699FF" bordercolordark="#D6D3CE">
<tr>
<td width="100%" bgcolor="#6699FF" Class="title1">站内搜索引擎</td>
</tr>
<tr>
<td width="100%" align="center" nowrap><input type="text" name="Search" size="20">
<input type="submit" value=" 给我搜 " name="Search1"></td>
</tr>
<tr>
<td width="100%" align="center">精确匹配:<input type="radio" value="V1" name="R1">模糊匹配:<input type="radio" name="R1" checked value="V2"></td>
</tr>
</table>
</center>
</div>
</form>
<% End If %>
</td>
</tr>
<%
If strActive="Check" Then
strSearch=trim(Request.form("Search"))
strR=trim(Request.form("R1"))
If strSearch="" Then strSearch="www.3rom.com"
set rs2=server.CreateObject("ADODB.RecordSet")
If strR="V2" Then
strSql="Select * from News where (News_Title like"
strSql=strSql & " '%" & strSearch & "%'"
strSql=strSql & " or News_Content like"
strSql=strSql & " '%" & strSearch & "%'"
strSql=strSql & " or News_Author like"
strSql=strSql & " '%" & strSearch & "%'"
strSql=strSql & " or News_Freind like"
strSql=strSql & " '%" & strSearch & "%'"
strSql=strSql & " or News_Link like"
strSql=strSql & " '%" & strSearch & "%'"
strSql=strSql & ")"
strSql=strSql & " order by NewsID Desc"
Else
strSql="Select * from News where (News_Title="
strSql=strSql & " '" & strSearch & "'"
strSql=strSql & " or News_Content="
strSql=strSql & " '" & strSearch & "'"
strSql=strSql & " or News_Author="
strSql=strSql & " '" & strSearch & "'"
strSql=strSql & " or News_Freind="
strSql=strSql & " '" & strSearch & "'"
strSql=strSql & " or News_Link="
strSql=strSql & " '" & strSearch & "'"
strSql=strSql & ")"
strSql=strSql & " order by NewsID Desc"
End If
rs2.Open strSql,MyCon,1,1
%>
<tr>
<td width="100%" valign="top" align="center">
<% If not rs2.eof Then %>
<div align="Left">
关键字:<font color="red"><%=strSearch%></font>
找到<%=rs2.RecordCount%>条相关新闻
</div>
<% Else %>
<div align="center">
找不到相关内容
</div>
<% End If %>
</td>
</tr>
<% Do while not rs2.eof %>
<tr>
<td width="100%" valign="top" align="center">
<div align="left">
<a href="ReadNews.asp?NewsID=<%=rs2("NewsID")%>" target="_blank" title="<%=rs2("News_Post_Time")%>">
<%=rs2("News_Title")%>
</a>
</div>
</td>
</tr>
<% rs2.movenext %>
<% Loop %>
<% rs2.close
set rs2=nothing
%>
<% End If %>
</table>
</center>
</div>
</td>
<td width="97" valign="top" align="left"></td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="755">
<tr>
<td width="100%" bgcolor="#F5F5F5" align="right"><img border="0" src="IMAGES/logo_3rom_by.gif" alt="又要考试了,真累人啊!"></td>
</tr>
</table>
</center>
</div>
</body>
</html>
<%
rs.close
set rs=nothing
MyCon.close
set MyCon=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -