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

📄 search.asp

📁 新闻发布系统
💻 ASP
字号:
<!--#include file=conn.asp-->

<head>
<title>新闻搜索</title>
<LINK href=Fsmanage/css/css.css rel=stylesheet>
<%
'=========================================================
'产品目录:风讯产品N系列
'软件名称:风讯站点管理系统
'当前版本:2004.I.0225
'最新更新:2004.2.10
'=========================================================
'Copyright (C) 2002-2004 cooin.com. All rights reserved.
'网站: http://www.cooin.com  Foosun.net
'程序制作:轻风云(QQ:655071)
'Email:skeen@cooin.com,skeen@Foosun.net
'论坛支持:风讯在线论坛(http://bbs.cooin.com   http://bbs.foosun.net)
'=========================================================
keyword = request("keyword")


  if keyword="" then
%>
<script luanage=javascript>
history.back()
alert("请输入新闻关键字!")
</script>
<%
  response.end
  end if
%>
</head>

  <body topmargin="7">
<table width="750" border="1" align="center" cellpadding="3" cellspacing="0"  align=center>
  <tr> 
    <td width="90%" height="20" align=center bgcolor=#cde4f0><div align="left" class="titlebig"><strong><font color="#FF0000">新闻搜索             </font></strong><font color="#000000"> 新闻关键字<font color="#FF0000">:<%=request("KeyWord")%></font></font></div></td>
  </tr>
   <% 
 const MaxPerPage=20
 dim totalPut 
 dim CurrentPage 
 dim TotalPages 
 dim i,j 
 if not isempty(request("page")) then 
 currentPage=cint(request("page")) 
 else 
 currentPage=1 
 end if 
%>

  
  
  <%
  set rs = server.createobject("adodb.recordset")
  if request("condition")="title" then
    sql = "select * from news where title like '%"&replace(request.form("keyword"),"'"," ")&"%' order by Date DESC"
  end if
  if request("condition")="content" then
    sql = "select * from news where content like '%"&replace(request.form("keyword"),"'"," ")&"%' order by Date DESC"
   end if
  if request("condition")="author" then
    sql = "select * from news where author like '%"&replace(request.form("keyword"),"'"," ")&"%' order by Date DESC"
   end if
   
   
  rs.open sql,conn,1,3
   if rs.eof then
     response.write("<tr><td width=90% height=""299"" align=center bgcolor=#ffffff><font color=red>没有找到相关的新闻。请<a href=""javascript:history.back();"">返回</a>重新搜索</font></td></tr>")
   
   else
 
   
  totalPut=rs.recordcount 
 totalPut=rs.recordcount 
 if currentpage<1 then 
 currentpage=1 
 end if 
 if (currentpage-1)*MaxPerPage>totalput then 
	 if (totalPut mod MaxPerPage)=0 then 
	 currentpage= totalPut \ MaxPerPage 
	 else 
	 currentpage= totalPut \ MaxPerPage + 1 
	 end if 
 end if 
if currentPage=1 then 
 'showpages 
 showContent 
					showpages 
	 else 
		 if (currentPage-1)*MaxPerPage<totalPut then 
		 rs.move (currentPage-1)*MaxPerPage 
		 dim bookmark 
		 bookmark=rs.bookmark 
 'showpages 
 showContent 
					showpages 
 else 
			 currentPage=1 
 'showpages 
 showContent 
 showpages 
			 end if 
			 end if 
			 rs.close 
 end if 
	 
 set rs=nothing 
 conn.close 
 set conn=nothing 
 
 
 sub showContent 
 dim i 
	 i=0 
 
  
%>   
   
           <p style="word-spacing: 0; line-height: 150%; text-indent: 0; margin-left: 0; margin-right: 3; margin-top: 0; margin-bottom: 0"> 
          共有<font color="#EF5952"><%=totalPut%></font>条记录
   
   
   
   
   
   
   
   
  <%
  do while not rs.eof

        response.write("<tr><td width=90% height=""20"" bgcolor=#ffffff><b>·</b><a href="&rs("LPath")&rs("FileName")&".html target=_blank>"&rs("title")&"</a><font color=red size=1>"&rs("Date")&"</font></td></tr>")
    
    
   i=i+1 
	 if i>=MaxPerPage then exit do 
	 rs.movenext 
	 loop
end sub 


 sub showpages() 
 dim n 
	 if (totalPut mod MaxPerPage)=0 then 
	 n= totalPut \ MaxPerPage 
	 else 
	 n= totalPut \ MaxPerPage + 1 
	 end if 
	 if n=1 then 
	 response.write "<p align='left'style='word-spacing: 0; line-height: 150%; text-indent: 0; margin: 0'>" 
	 exit sub 
 end if 
	 dim k 
	 response.write "<p align='left'style='word-spacing: 0; line-height: 150%; text-indent: 0; margin: 0'> 分页"
	 for k=1 to n 
	 if k=currentPage then 
	 response.write "[<b>"+Cstr(k)+"</b>] " 
		 else 
		 response.write "[<b>"+"<a href='search.asp?page="+cstr(k)+"&condition="+request("condition")+"&keyword="+request("keyword")+"' style='color:#aa4466'>"+Cstr(k)+"</a></b>] " 
		 end if 
	 next 
 	 response.write "" 
 end sub %>

<tr><td><%showpages%></td></tr>
</table>

⌨️ 快捷键说明

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