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

📄 news_search.asp

📁 直接附加数据库! 修改 Include/ Class_Main.asp 为自己信息 后台admin admin 绍兴人才网程序
💻 ASP
字号:
<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<% 
Dim SQL,Rs,i,TypeName,Typeid,N_TypeName
Dim Title,FileName,Path,DateAndTime
Dim Class1,Key
'//跨站检测
Check_Url()
'//获取参数值
Class1   = Replace_Text(Request("class"))
Key      = Replace_Text(Request("key"))
'//开始从数据库中获取某类别的新闻
SQL = "Select Title,FileName,Path,DateAndTime From [pH_New_Info] Where Flag=1 And (Title Like '%"&Key&"%' or Content Like '%"&Key&"%')" 
If Class1 <> "0" Then
 SQL = SQL&" And Typeid="&Cstr(Class1)
End if
SQL = SQL&" Order By DateAndTime Desc"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open SQL,Conn,1,1

Rs.Pagesize = 25
Psize       = Rs.PageSize
PCount      = Rs.PageCount
RCount      = Rs.RecordCount

PageNo = Cint(Request.QueryString("PageNo"))
If PageNo < 1 Then
 PageNo = 1
Elseif PageNo > PCount Then
 PageNo = PCount
End if
Thepage = (PageNo-1)*Psize
If Not Rs.Eof Then Rs.AbsolutePage = PageNo

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../Css/Style.css" type=text/css rel=stylesheet>
<title><%= Cls_WebName %> --  文章搜索</title>
</head>
<script language="JavaScript">
 function search_check(){
 if (document.theForm.key.value=="请输入文章关键字"){
  alert("-请输入文章关键字-");
  document.theForm.key.focus();
  return false;
 }
 }
</script>
<body>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><!--#include file="../Include/Header.asp" --></td>
  </tr>
</table>
<table width="956" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td> 
      <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="4"></td>
        </tr>
      </table>
      <table width="956" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="209" valign="top"> 
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table2">
              <tr class="td_4"> 
                <td height="29"><font class="td_4a">新闻栏目</font></td>
              </tr>
              <tr> 
                <td> 
                  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <% 
				  SQL = "Select Top 10 * From [pH_New_Type]"
				  Set Re = Conn.Execute(SQL)
				  While Not Re.Eof
				   TypeName = Re("Type")
				   Typeid   = Re("Typeid")
				   %>
                    <tr> 
                      <td height="20"><img src="../Images/icon3.gif" width="12" height="16">&nbsp; 
                        <a href="?Param=<%= Typeid %>"><%= TypeName %></a></td>
                    </tr>
                    <% 
				    Re.Movenext
				   Wend
				   Re.Close
				  
				    %>
                  </table>
                </td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="5"></td>
              </tr>
              <tr> 
                <td valign="top"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table2">
                    <form action="News_Search.asp" method="post" target="_blank" name="theForm" onSubmit="return search_check()">
                      <tr> 
                        <td height="5" align="center"></td>
                      </tr>
                      <tr> 
                        <td height="25" align="center"> 
                          <select name="select" style="width:140px;">
                            <option value="0">文章类别不限</option>
                            <% 
				  SQL = "Select * From [pH_New_Type]"
				  Set Re = Conn.Execute(SQL)
				  While Not Re.Eof
				   TypeName = Re("Type")
				   Typeid   = Re("Typeid")
	%>
                            <option value="<%= Typeid %>"><%= TypeName %></option>
                            <% 
				    Re.Movenext
				   Wend
				   Re.Close
				   Set Re = Nothing
	%>
                          </select>
                        </td>
                      </tr>
                      <tr> 
                        <td height="25" align="center"> 
                          <input name="key2" style="width:140px;" size="16" maxlength=50 value="请输入文章关键字" onClick="this.value='';">
                        </td>
                      </tr>
                      <tr> 
                        <td height="25" align="center">
                          <input type="submit" name="Submit32" value=" 开 始 搜 索 ">
                        </td>
                      </tr>
                    </form>
                  </table>
                </td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" height="5">
              <tr> 
                <td></td>
              </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table2">
              <tr class="td_4"> 
                <td height="29"><font class="td_4a">热门信息</font></td>
              </tr>
              <tr> 
                <td> <%= Cls_News_Param("HotNew=1",6,14) %></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" height="5">
              <tr> 
                <td></td>
              </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table2">
              <tr class="td_4"> 
                <td height="29"><font class="td_4a">相关推荐</font></td>
              </tr>
              <tr> 
                <td> <%= Cls_News_Param("BestNew=1",6,14) %></td>
              </tr>
            </table>
          </td>
          <td width="5">&nbsp;</td>
          <td valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="500" valign="top"> 
                  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table2">
                    <tr class="td_4"> 
                      <td height="29"><font class="td_4a">文章搜索</font></td>
                    </tr>
                    <tr> 
                      <td> 
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <% 
For i = 1 To Psize
 If Rs.Eof Then Exit For 
 Title        = Rs("Title")
 FileName     = Rs("FileName")
 Path         = Rs("Path")
 DateAndTime  = Year(Rs("DateAndTime"))&"."&Month(Rs("DateAndTime"))&"."&Day(Rs("DateAndTime"))
%>
                          <tr> 
                            <td height="22">&nbsp;&middot;<a href="../<%= Path %>/<%= FileName %>" target="_blank"><%= Title %></a> 
                              <font size="1" color="#999999">[<%= DateAndTime %>]</font></td>
                          </tr>
                          <% 
 Rs.Movenext
Next

 %>
                        </table>
                        <table width="98%" border="0" align="center" cellpadding="4" cellspacing="4" bgcolor="#EEF7FF">
                          <tr> 
                            <td width="50%" height="25">共<font color="#FF0000"><%= RCount %></font>条 
                              分<font color="#FF0000"><%= PCount %></font>页 | 当前第<font color="#FF0000"><%= PageNo %></font>页</td>
                            <td width="50%" align="right"> 
                              <% 
		  If PageNo > 1 Then
		   Response.write "<a href=""?PageNo=1&class="&Class1&"&key="&Key&""">首页</a>&nbsp;"
		   Response.write "<a href=""?PageNo="&PageNo-1&"&class="&Class1&"&key="&Key&""">上页</a>&nbsp;"    
		  Else
		   Response.write "首页&nbsp;"
		   Response.write "上页&nbsp;" 
		  End if
		   %>
                              <% 
		  If PageNo < PCount Then
		   Response.write "<a href=""?PageNo="&PageNo+1&"&class="&Class1&"&key="&Key&""">下页</a>&nbsp;"
		   Response.write "<a href=""?PageNo="&PCount&"&class="&Class1&"&key="&Key&""">尾页</a>"   
		  Else
		   Response.write "下页&nbsp;"
		   Response.write "尾页" 
		  End if
		   %>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td width="5">&nbsp;</td>
                <td width="150" valign="top" bgcolor="#F5F5F5"> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td height="70" align="center"><img src="../Ad_Imgs/148_60_1(1).gif" width="148" height="60"></td>
                    </tr>
                    <tr> 
                      <td height="70" align="center"><img src="../Ad_Imgs/148_60_1(2).gif" width="148" height="60"></td>
                    </tr>
                    <tr> 
                      <td height="70" align="center"><img src="../Ad_Imgs/148_60_1(3).gif" width="148" height="60"></td>
                    </tr>
                    <tr> 
                      <td height="70" align="center"><img src="../Ad_Imgs/148_60_1(4).gif" width="148" height="60"></td>
                    </tr>
                    <tr> 
                      <td height="70" align="center"><img src="../Ad_Imgs/148_60_1(5).gif" width="148" height="60"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="1" bgcolor="#eeeeee"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><!--#include file="../Include/Footer.asp" --></td>
  </tr>
</table>
</body>
</html>
<% 
Rs.Close
Set Rs = Nothing
CloseDB()
 %>

⌨️ 快捷键说明

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