📄 search.asp
字号:
<!--#include file="top.asp"-->
<table width="800" height="403" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="Table_01">
<tr>
<td height="403" colspan="2" valign="top" background="images/right_06.gif"><!--#include file="Tyi86_Left_Other.asp" --></td>
<td width="800" align="right" valign="top" background="images/t_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><img src="images/t_04.gif" width="581" height="29" alt=""></td>
</tr>
<tr>
<%
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim idlist
dim Title
Title=Trim(Request.Form("txtitle"))
If Session("search")="" and Title="" Then : Session("search")=Title
If Request("page")<>"" Then
else
Session("search")=Title
End If
if not isempty(request("page")) then
currentPage=Trim(request("page"))
else
currentPage=1
end if
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
dim sql
dim rs
%><form method=Post action="search.asp">
<td height="361" align="center" valign="top" background="images/t_05.gif">
<%
If session("search")<>"" Then : title=session("search")
if title<>"" then
sql="select * from News where title like '%"&trim(title)&"%' or content like '%"&trim(title)&"%' order by ID desc"
end if
if title="" then
sql="select * from Info order by ID desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<br><br><p align='center'>没有找到任何信息...</p>"
else
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
showpage totalput,MaxPerPage,"Search.asp"
showContent
showpage totalput,MaxPerPage,"Search.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"Search.asp"
showContent
showpage totalput,MaxPerPage,"Search.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"Search.asp"
showContent
showpage totalput,MaxPerPage,"Search.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
do while not rs.eof
%>
<table width="96%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="7%" height="20" align="center" background="images/22.gif"><img src="images/tb.gif" width="6" height="6"></td>
<td width="93%" background="images/22.gif"><a href="new.asp?id=<%response.write rs(0)%>" title="<%=rs("title")%>"><% if Getlen(rs("title"))>48 then%>
<%=LeftStr(rs("title"),45)%>...
<%else%>
<%response.write rs("title")%>
<%end if%></a> [ <%=rs("time")%> ]</td>
</tr>
</table>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<table width="96%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="17" align="right" bgcolor="#F7F7F7"><%
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 "<p align='center'> "
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write " 页次:<strong>"&CurrentPage&"/"&n&"</strong>页"
response.write " 共<b>"&totalnumber&"</b>篇文章 <b>"&maxperpage&"</b>篇文章/页"
end function
%></td>
</tr>
</table>
</td></form>
</tr>
</table></td>
</tr>
</table>
<!--#include file="end.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -