search1.asp
来自「烈火之家整站程序 本程序集商业娱乐一体,本来是给自己用的但是我的国外空间支持不够」· ASP 代码 · 共 173 行
ASP
173 行
<!--#include file="conn.asp"-->
<!--#include file="top.asp"-->
<% set rs=server.CreateObject("adodb.recordset")
%>
<%
dim MaxperPage,Search_Type,Search_Sql,Search_Keywords,i
MaxPerPage=60
Search_Keywords=Request("Search_Keywords")
Search_Type=Request("Search_Type")
select case (Search_Type)
case "music" Search_Sql="select special_id,special_name,image from SongSpecial where Special_Name like '%"&Search_Keywords&"%'"
case "flash" Search_Sql="select specialID,specialname,picsrc from FlashSpecial where specialname like '%"&Search_Keywords&"%'"
case "video" Search_Sql="select specialID,specialname,picsrc from VideoSpecial where specialname like '%"&Search_Keywords&"%'"
end select
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"><tr>
<td valign="top" width="100%" align="center">
<%
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
rs.open Search_Sql,conn,1,1
if rs.eof and rs.bof then
response.write "<br><br>暂时没有与 <font color=#ff0000>"&Search_Keywords&"</font> 相关的信息<br><br>"
else
PageUrl="Search.asp?Search_Type="&Search_Type&"&Search_Keywords="&Search_Keywords
totalPut=rs.recordcount
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
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
else
currentPage=1
showpage totalput,MaxPerPage,PageUrl
showContent
end if
end if
end if
rs.close
sub showContent
select case (Search_Type)
'搜索歌曲
case "music"
response.write "<table border=""0"" width=""760"" cellspacing=""1"" cellpadding=""1"" >"
i=0
do while not rs.eof
i=i+1
if len(rs("image"))>0 then
picsrc=rs("image")
else
picsrc="img/blank.gif"
end if
response.write "<tr>"&_
"<td><a href=music/Special_Show.asp?Special_Id="&rs("Special_Id")&"><img src="&picsrc&" width=120 height=120 border=0></a><br>"&rs("Special_Name")&"</td>"
if i mod 5=0 then
response.write "</tr>"
end if
if i>=MaxPerPage then exit do
rs.movenext
loop
response.write "</table>"
'搜索动漫
case "flash"
response.write "<table border=""0"" width=""760"" cellspacing=""1"" cellpadding=""1"" >"
i=0
do while not rs.eof
i=i+1
if len(rs("picsrc"))>0 then
picsrc=rs("picsrc")
else
picsrc="img/blank.gif"
end if
response.write "<tr>"&_
"<td><a href=flash/SpecialShow.asp?SpecialId="&rs("SpecialId")&"><img src="&picsrc&" width=100 height=100 border=0></a><br>"&rs("SpecialName")&"</td>"
if i mod 5=0 then
response.write "</tr>"
end if
if i>=MaxPerPage then exit do
rs.movenext
loop
response.write "</table>"
'搜索视频
case "video"
response.write "<table border=""0"" width=""760"" cellspacing=""1"" cellpadding=""1"" >"
i=0
do while not rs.eof
i=i+1
if len(rs("picsrc"))>0 then
picsrc=rs("picsrc")
else
picsrc="img/blank.gif"
end if
response.write "<tr>"&_
"<td><a href=video/SpecialShow.asp?SpecialId="&rs("SpecialId")&"><img src="&picsrc&" width=100 height=100 border=0></a><br>"&rs("SpecialName")&"</td>"
if i mod 5=0 then
response.write "</tr>"
end if
if i>=MaxPerPage then exit do
rs.movenext
loop
response.write "</table>"
end select
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 "<form method=Post action="&filename&">"&_
"共找到<b>"&totalnumber&"</b>项记录"
if CurrentPage<2 then
response.write " 首页 上一页 "
else
response.write " <a href="&filename&"&page=1>首页</a> <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&">下一页</a> "&_
"<a href="&filename&"&page="&n&">末页</a>"
end if
response.write " 页次:<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>"
end function
%>
</td>
</tr></table>
<!-- #include file="foot.asp" -->
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?