📄 productsearch.asp
字号:
</div></td>
<td height="300"></td>
<td width="600" height="300" valign="top">
<div align="center">
<table width="99%" height="92" border="0" cellpadding="0" cellspacing="0" class=main1 >
<tr>
<td width="100%" height="22" valign="middle">搜索<font color="#0000FF"><%=request("Search")%></font>的结果:</td>
</tr>
<tr>
<td width="100%" height="1" valign="middle" bgcolor="#B8A194"> </td>
</tr>
<tr>
<td width="100%" height="5" valign="middle"> </td>
</tr>
<tr>
<td width="100%" height="72"> <table border="0" cellpadding="0" cellspacing="0" width="100%" height="75" class=main1>
<tr>
<td valign="top" height="85"> <div align="center">
<%
up=request("up")
Search=request("Search")
jiage=request("jiage")
if jiage="" then jiage=100
Product_Class=request("Product_Class")
set rs=server.createobject("adodb.recordset")
select case up
case "商品名称"
if Product_Class="所有类别" then
sqltext="select * from Product where P_NewPrice<"&jiage&" and Product_Name like '%"&Search&"%'"
else
sqltext="select * from Product where P_NewPrice<"&jiage&" and Product_Name like '%"&Search &"%' and Class_1='"&Product_Class&"'"
end if
case "网店名称"
if Product_Class="所有类别" then
sqltext="select * from Product where P_NewPrice<"&jiage&" and shop_name2 like '%"&Search&"%'"
else
sqltext="select * from Product where P_NewPrice<"&jiage&" and shop_name2 like '%"&Search&"%' and Class_1='"&Product_Class&"'"
end if
case "商品所在地"
if Product_Class="所有类别" then
sqltext="select * from Product where P_NewPrice<"&jiage&" and locus like '%"&Search&"%'"
else
sqltext="select * from Product where P_NewPrice<"&jiage&" and locus like '%"&Search&"%' and Class_1='"&Product_Class&"'"
end if
case "商品简介"
if Product_Class="所有类别" then
sqltext="select * from Product where P_NewPrice<"&jiage&" and Product_Intro like '%"&Search&"%'"
else
sqltext="select * from Product where P_NewPrice<"&jiage&" and Product_Intro like '%"&Search&"%' and Class_1='"&Product_Class&"'"
end if
case else
sqltext="select * from Product where P_NewPrice<"&jiage&" and Product_Name like '%"&Search&"%'"
end select
rs.open sqltext,conn,1,1
dim MaxPerPage
MaxPerPage=13
'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
'假如没有商品时
If rs.eof and rs.bof then
response.write "<td><p align='center'><font color='#ff0000'>没有找到符合条件的商品资料</font></p></td>"
response.end
End if %>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#B5CA9F" bordercolordark="#FFFFFF" class=main1>
<%row_count=1
'显示帖子的子程序
Sub list()%>
<%i=0
Do While Not rs.EOF%>
<tr>
<td width="18%" height="90" align="center"><a href="<%=rs("p_shop")%>/default.asp?sb=product&Product_id=<%=rs("Product_id")%>" target="_blank"><img src="<%=rs("small_pic")%>" name="small" width="75" height="78" border="0" ></a></td>
<td width="82%"><font color="#666666"><a href="<%=rs("p_shop")%>/default.asp?sb=product&Product_id=<%=rs("Product_id")%>"><font color="#0000FF"><%=rs("Product_Name")%></font></a><br>
市场价:</font><span class="main1"><strike><%=rs("P_OldPrice")%>元</strike></span><font color="#cc0000"> </font><font color="#cc0000"> </font> <font color="#cc0000">会员价:</font><%=rs("P_NewPrice")%>元 <font color="#666666">所属网店:</font><a href="<%=rs("p_shop")%>/" target="_blank"><%=rs("shop_name2")%></a><br>
<font color="#999999">商品简介: <%=left(rs("Product_Intro"),33)%>……</font></td>
</tr>
<tr>
<td colspan="2" background="PIC/bg-line2.gif" height="1"> </td>
</tr>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.MoveNext
Loop
end Sub
%>
<% call list
If Rs.recordcount > MaxPerPage then
call showpages
end if%>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#B8A194">
<tr>
<td height="1"> </td>
</tr>
</table>
</div>
<%
'显示翻页的子程序
sub showpages()%>
<table border="0" cellPadding="0" cellSpacing="0" width="96%" >
<br>
<tr>
<td >
<table border="0" cellPadding="0" cellSpacing="0" width="100%" height="30">
<form method='POST' action='ProductSearch.asp'>
<input type="hidden" name="Product_Class" value="<%=request("Product_Class")%>" >
<input type="hidden" name="Product_Name" value="<%=request("Product_Name")%>" >
<tr>
<td width="100%"> <font color="#000000">
<p align="center">
<%
If currentpage > 1 Then
response.write "<a href='ProductSearch.asp?&page="+cstr(1)+"&Product_Class="+Product_Class+"&Search="+Search+"&up="+up+"&jiage="+jiage+"'><font color='#000000'>首页</font></a><font color='#000000'><b>-</b></font>"
Response.write "<a href='ProductSearch.asp?page="+Cstr(currentpage-1)+"&Product_Class="+Product_Class+"&Search="+Search+"&up="+up+"&jiage="+jiage+"'><font color='#000000'>前页</font></a><font color='#000000'><b>-</b></font>"
Else
Response.write "<font color='#000000'>首页-</font>"
Response.write "<font color='#000000'>前页-</font>"
End if
If currentpage < Rs.PageCount Then
Response.write "<a href='ProductSearch.asp?page="+Cstr(currentPage+1)+"&Product_Class="+Product_Class+"&Search="+Search+"&up="+up+"&jiage="+jiage+"'><font color='#000000'>后页</font></a><font color='#000000'><b>-</b></font>"
Response.write "<a href='ProductSearch.asp?page="+Cstr(Rs.PageCount)+"&Product_Class="+Product_Class+"&Search="+Search+"&up="+up+"&jiage="+jiage+"'><font color='#000000'>尾页</font></a> "
Else
Response.write "<font color='#000000'>后页-</font>"
Response.write "<font color='#000000'>尾页</font> "
End if
Response.write "<font color='#000000'>页次:</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font> "
Response.write "<font color=#ff0000>" & Cstr(MaxPerPage) & "</font>" & "<font color='#000000'>种商品/页 " & "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>种商品</font> "
response.write "<font color='#000000' class=main1>转到第:</font><input type='text' name='page' size=2 maxlength=3 class=smallInput value="&Currentpage&"> 页 "
response.write "<input class=buttonface type='submit' value='Go' name='cndok' style='background-color: #E6E4C4'></span>"
%>
</font>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<%end sub%>
<!--#include file="bottom.asp" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -