📄 productsearch.asp
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="conn.asp" -->
<%
ProductClass_2=request("ProductClass_2")
set rs=server.createobject("adodb.recordset")
sqltext="select * from Product"
if request("Product_Name")<>"" then
sqltext=sqltext &" where Product_Name like '%"& request("Product_Name") &"%' "
else
sqltext=sqltext &" where Product_Name like '%"& "" &"%' "
end if
if request("Product_Class")<>"" then
sqltext=sqltext &" and Class_1 like '%"& request("Product_Class") &"%' "
end if
rs.open sqltext,conn,1,1
dim MaxPerPage
MaxPerPage=9
'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
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
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<STYLE>BODY {
FONT-SIZE: 9pt
}
TD {
FONT-SIZE: 9pt
}
A {
TEXT-DECORATION: none
}
A:hover {
TEXT-DECORATION: underline
}
</STYLE>
<SCRIPT language=javascript>
<!--
function isok(theform)
{
if (theform.uid.value=="")
{
alert("会员帐号不能为空!");
theform.uid.focus();
return (false);
}
if (theform.pwd.value=="")
{
alert("对不起!密码不能为空!");
theform.pwd.focus();
return (false);
}
return (true);
}
-->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
function openbag(url,name){
window.open(url,name,"height=200,width=600,left=190,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no")}
-->
</SCRIPT>
<title>产品分类<%= request("Product_Name")%><%= request("Product_Class")%></title>
</head>
<body leftmargin="0" topmargin="0">
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><iframe src=top.asp noresize scrolling=no frameborder=0 width=778 height=100 hspace="0" vspace="0" marginheight="0"></iframe>
</td>
</tr>
</table>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="778" height="253" background="images/back.gif">
<tr>
<td width="17%" height="300" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="266">
<tr>
<td width="100%" height="15"><img border="0" src="pic/ProductClass001.gif"></td>
</tr>
<tr>
<td
style="border-left: 1px solid #ff7142; border-right: 1px solid #ff7142; border-bottom: 1px solid #ff7142"
width="100%" height="70">
<div align=center>
<table width="100%" border="1" cellspacing="0" cellpadding="2" bgcolor="#FFF0E8" bordercolorlight="#FFDBC8" bordercolordark="#FFFFFF" height="66">
<tr>
<td width="166" height="60" valign="top">
<div align='center'>
<form action=user/ReLoginCheck.asp method=post onSubmit="return isok(this)">
<br>
用户:
<input type="text" name="uid" size="11">
<br>
<br>
密码:
<input type="password" name="pwd" size="11">
<br>
<br>
<input type="submit" value="登录" name="B1" tabindex="1" style="font-size: 14px">
<input type="reset" value="重置" name="B2" style="font-size: 14px">
</form>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td width="100%" height="15"> </td>
</tr>
<tr>
<td width="100%" height="15"></td>
</tr>
<tr>
<td width="100%" height="15"><img border="0" src="pic/ProductClass002.gif"></td>
</tr>
<tr>
<td
style="border-left: 1px solid #ff7142; border-right: 1px solid #ff7142; border-bottom: 1px solid #ff7142"
width="100%" height="70">
<div align=center>
<table width="100%" border="1" cellspacing="0" cellpadding="2" bgcolor="#FFF0E8" bordercolorlight="#FFDBC8" bordercolordark="#FFFFFF" height="66">
<tr>
<td width="166" height="60" valign="top">
<div align='center'>
<form method='POST' action='ProductSearch.asp'>
<br>
商品名称:
<input type='text' name='Product_Name' size='10' class='a'>
<br>
<br>
商品类别:
<select name="Product_Class" size="1" tabindex="0" class="a" FONT-SIZE: 9pt>
<option value="日常用品">日常用品</option>
<option value="食品餐饮">食品餐饮</option>
<option value="日用家电">日用家电</option>
<option value="服装服饰">服装服饰</option>
<option value="医疗保健">医疗保健</option>
<option value="文体用品 ">文体用品</option>
</select>
<br>
<br>
<input type='submit' value='查询' name='Submit' class='a' style="font-size: 14px">
<input type='reset' value='重填' name='Reset' class='a' style="font-size: 14px">
</form>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
<td width="3%" height="300"></td>
<td width="80%" height="300" valign="top">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class=main1 height="92" >
<tr>
<td width="100%" bgcolor="#E6E4C4" height="22" valign="middle"> <a href="default.asp">首页</a>
==> <%=request("Product_Name")%></td>
</tr>
<tr>
<td width="100%" height="15" 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">
<%
'假如没有商品时
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="1" cellpadding="0" cellspacing="0" width="100%" bordercolorlight="#6D8E4D" bordercolordark="#FFFFFF" class=main1 height="55">
<tr>
<td width="13%" align="center" bgcolor="#6D8E4D" height="23"><font color="#FFFFFF">商品编号</font></td>
<td width="38%" align="center" bgcolor="#6D8E4D" height="23"><font color="#FFFFFF">商品名称</font></td>
<td width="16%" align="center" bgcolor="#6D8E4D" height="23"><font color="#FFFFFF">会员价</font></td>
<td width="18%" align="center" bgcolor="#6D8E4D" height="23"><font color="#FFFFFF">销售商</font></td>
<td width="15%" align="center" bgcolor="#6D8E4D" height="23"><font color="#FFFFFF">购买</font></td>
</tr>
<%row_count=1
'显示帖子的子程序
Sub list()%>
<%i=0
Do While Not rs.EOF%>
<tr>
<td width="13%" align="center" height="28"><%=rs("Product_Id")%></td>
<td width="38%" align="center" height="28" ><a href="ProductDetail.asp?Product_id=<%=rs("Product_id")%>"><%=rs("Product_Name")%></a></td>
<td width="16%" align="center" height="28"><%=rs("P_NewPrice")%></td>
<td width="18%" align="center" height="28"><%=rs("P_shop")%></td>
<td width="15%" align="center" height="28"><a href="javascript:openbag('check.asp?cpbm=<%=rs("Product_Id")%>&shopname=<%=rs("p_shop")%>')"><img style="CURSOR: hand" height="22" src="images/che1.gif" width="56" align="absMiddle" border="0"></a></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>
</div>
<%
'显示翻页的子程序
sub showpages()%>
<table bgColor="#f8e8a0" border="0" cellPadding="0" cellSpacing="0" width="606" >
<br>
<tr><td >
<form method="POST" action="ProductSearch.asp">
<INPUT type=hidden value=<%=ProductClass_2%> name=ProductClass_2>
<table bgColor="#6D8E4D" border="0" cellPadding="0" cellSpacing="0" width="605" height="30">
<tr>
<td bgcolor="#E6E4C4" class=main1 width="450"> <font color="#000000">
<p align="center">
<%
Response.write "<font color='#000000'>页面-> </font>"
If currentpage > 1 Then
response.write "<a href='ProductSearch.asp?&page="+cstr(1)+"&ProductClass_2="+Cstr(ProductClass_2)+"'><font color='#000000'>首页</font></a><font color='#000000'><b>-</b></font>"
Response.write "<a href='ProductSearch.asp?page="+Cstr(currentpage-1)+"&ProductClass_2="+Cstr(ProductClass_2)+"'><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)+"&ProductClass_2="+Cstr(ProductClass_2)+"'><font color='#000000'>后页</font></a><font color='#000000'><b>-</b></font>"
Response.write "<a href='ProductSearch.asp?page="+Cstr(Rs.PageCount)+"&ProductClass_2="+Cstr(ProductClass_2)+"'><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 "</td><td align='center'>"
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>
</table>
</td>
</tr>
</table>
</form>
<%end sub%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -