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

📄 search.asp

📁 3000首FLASH源程序
💻 ASP
字号:
<%PageName="search.asp"%>
<!--#include file="function.asp"-->
<%
keyword=trim(request("keyword"))
keyword=replace(keyword,"'","''")
action=request("action")
if keyword="" then
	errmsg="<li>查找关键字不能为空</li>"
	call error()
	response.end
end if
%>
<!--#include file="top.asp"-->
<table width="770" align="center" cellspacing="1" bgcolor="<%=Tablebackcolor%>" cellpadding="2">
  <tr>  
    <td height=20 bgcolor="<%=Tabletitlecolor%>">□□□您输入的关键字:<font color=red><%=keyword%></font> 
    </td>
  </tr>
       <tr> 
        <td bgcolor="<%=Tablebodycolor%>"> 
<%
sql="select "&action&".id,"&action&".title,"&action&".classid,"&action&".authorid,"&action&".content,author.author from "&action&",author where "&action&".title Like '%"& keyword &"%' and "&action&".authorid=author.authorid order by "&action&".id desc"
rs.open sql,conn,1,1
if not isempty(request("page")) then
	currentPage=cint(request("page"))
else
	currentPage=1
end if
if rs.eof and rs.bof then
response.write "<p align='center'> 未找到符合你条件的<font color=#ff0000>"&keyword&"</font>任何图片</p>"
else
	totalPut=rs.recordcount
	PageUrl="search.asp"
	if currentpage<1 then currentpage=1
	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
		showpage totalput,MaxPerPage,PageUrl
		showContent
		showpage totalput,MaxPerPage,PageUrl
	else
		if (currentPage-1)*MaxPerPage<totalPut then
			rs.move  (currentPage-1)*MaxPerPage
			dim bookmark
			bookmark=rs.bookmark
			showpage totalput,MaxPerPage,PageUrl
			showContent
			showpage totalput,MaxPerPage,PageUrl
		else
			currentPage=1
			showpage totalput,MaxPerPage,PageUrl
			showContent
			showpage totalput,MaxPerPage,PageUrl
		end if
	end if
	rs.close
end if

sub showContent 
i=0 
do while not rs.eof
        response.write  i+1&".<a href="&action&"list.asp?id="&rs("id")&"&classid="&rs("classid")&" target=_blank>"&_
						replace(rs("title"),""&keyword&"","<font color=red>"&keyword&"</font>")&"</a>      ---作者:"&_
						"<a href=authorlist.asp?id="&rs("authorid")&" target=_blank>"&replace(rs("author"),""&keyword&"","<font color=red>"&keyword&"</font>")&_
						"</a><blockquote>"&replace(left(rs("content"),200),""&keyword&"","<font color=red>"&keyword&"</font>")&"......</blockquote>"
	 i=i+1
	 if i>=MaxPerPage then exit do
	 	rs.movenext
	 loop
end sub 

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
	n= totalnumber \ maxperpage
else
	n= totalnumber \ maxperpage+1
end if
response.write "<div align=right><form method=Post action="&filename&"?keyword="&keyword&"&action="&action&">"&_
				"共找到<b>"&totalnumber&"</b>项记录" 
if CurrentPage<2 then
response.write "&nbsp;首页 上一页&nbsp;"
else
response.write "&nbsp<a href="&filename&"?page=1&keyword="&keyword&"&action="&action&">首页</a>&nbsp;<a href="&filename&"?page="&CurrentPage-1&"&keyword="&keyword&"&action="&action&">上一页</a>&nbsp;" 
end if
if n-currentpage<1 then
response.write "下一页 末页 "
else
response.write "<a href="&filename&"?page="&CurrentPage+1&"&keyword="&keyword&"&action="&action&">下一页</a>&nbsp;"&_
                "<a href="&filename&"?page="&n&"&keyword="&keyword&"&action="&action&">末页</a>" 
end if
response.write "&nbsp;页次:<strong>"&CurrentPage&"/"&n&"</strong>页  转到:<select name='page' size='1' onchange='javascript:submit()'>"
               for i = 1 to n
response.write "<option value="&i
 				if cint(CurrentPage)=cint(i) then response.write " selected "
response.write ">第"&i&"页</option>"
                next
response.write "</select></form></div>"      
end function
%>
              </td>
            </tr>
          </table>
        <!--#include file="copyright.asp"-->
    <%
set rs=nothing
conn.close
set conn=nothing
%></body></html>

⌨️ 快捷键说明

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