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

📄 research2.asp

📁 上海购物网设计的购物系统是基于WEB开发的大型购物系统。   它以构建电子商务网站为目标
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%dim action,searchkey,categoryid,jiage
categoryid=request.form("categoryid")
jiage=request.form("jiage")
action=request.QueryString("action")
searchkey=request.QueryString("searchkey")
if categoryid="" then categoryid=request.QueryString("categoryid")
if jiage="" then jiage=request.QueryString("jiage")
if action="" then action=int(request.form("action"))
if searchkey="" then searchkey=trim(request.form("searchkey"))%>
<%call sss()%>
<title><%=webname%>--欢 迎 选 购</title>
<!--#include file="include/header.asp"--> 
<TABLE WIDTH="771" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER">
   <TR>
    <TD WIDTH="779" HEIGHT="30" ALIGN="CENTER" BGCOLOR=#FFFFFF> <B><FONT COLOR="#FF0000">^^</FONT><FONT COLOR="#FF6600"> 
      欢 迎 选 购 <font color="#FF0000">^^</font></FONT></B></TD>
  </TR></TABLE>
<table width="771" border="0" cellspacing="1" cellpadding="0" align="center" BGCOLOR=<%=bgclr1%>>
  <tr>
    <td VALIGN="TOP" BGCOLOR=<%=bgclr4%>><table height="100%" bgcolor="#EAEAEA">
        <tr> 
          <td width="182" align="center" valign="top"> <br>
            <TABLE width="165" BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#FFFFFF">
              <tr 
					  > 
                <td bgcolor="#CC9999"> <div align="center"><img height=25 
            src="images/skin/default/search_title.gif" width=94></div></td>
              </tr>
              <tr 
					  > 
                <form name="searchform" method="post" action="research.asp" >
                  <td width="250" height="70"> &nbsp;&nbsp;&nbsp;&nbsp; <select name="action" id="select2">
                      <option value="1">按商品名称查询</option>
                      <option value="2">按商品品牌查询</option>
                      <option value="3">按商品类别查询</option>
                    </select> <br> &nbsp;&nbsp;&nbsp;&nbsp; <input name="searchkey" type="text" size="10" value="关键字" onFocus="this.value=''"> 
                    <input type="submit" name="Submit2" value="查询" onClick="return check();" > 
                    <br> <a href="search.asp">&nbsp;&nbsp;&nbsp;&nbsp; 详细查询</a> 
                  </td>
                </form>
              </tr>
            </TABLE>
            <br> 
            <!--#include file="include/pronav2.asp" -->
            <br>
            <!--#include file="include/pipa2.asp" -->
            <br>

            <a href=<%=zuo1url%> target="_blank"><img src=<%=zuo1%> border="0" width="165"></a> 
            <br>
            <A HREF=<%=zuo1url%> TARGET="_blank"> </A> <A HREF=<%=zuo2url%> TARGET="_blank"><br>
            <IMG SRC=<%=zuo2%> BORDER="0" WIDTH="165"><br>
            <br>
            </A> <A HREF=<%=zuo3url%> TARGET="_blank"><br>
            <IMG SRC=<%=zuo3%> BORDER="0" WIDTH="165"></A></td>
        </tr>
        <tr> 
          <td align="center">&nbsp; </td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td align="center">&nbsp;</td>
        </tr>
      </table></td>
    <td WIDTH="100%" VALIGN="TOP" BGCOLOR=<%=bgclr4%>> <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr> 
          <td style="padding-left:6px"> 
            <%if searchkey="" then
	response.write "对不起,请您输入查询关键字"
	response.End
	else
	response.write "您查询的关健字是:<font color=red>"&searchkey&"</font>"
	end if%>
          </td>
        </tr>
      </table>
      <%'开始分页
				Const MaxPerPage=10
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    				if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 
				
set rs=server.CreateObject("adodb.recordset")
if jiage="" then  '//普通查询
select case action
case "1"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where name like '%"&searchkey&"%' ",conn,1,1
case "2"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where mark like '%"&searchkey&"%' ",conn,1,1
case "3"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where introduce like '%"&searchkey&"%' ",conn,1,1
case "4"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,detail,productdate from product where detail='"&searchkey&"' ",conn,1,1
end select
else
'//高级查询
if categoryid<>0 then  '//判断查询分类,分类不为空。  
select case action
case "1"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where name like '%"&searchkey&"%' and price2<"&jiage&" and categoryid="&categoryid,conn,1,1
case "2"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where mark like '%"&searchkey&"%' and price2<"&jiage&" and categoryid="&categoryid,conn,1,1
case "3"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where introduce like '%"&searchkey&"%' and price2<"&jiage&" and categoryid="&categoryid,conn,1,1
case "4"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,detail,productdate from product where detail='"&searchkey&"' and price2<"&jiage&" and categoryid="&categoryid,conn,1,1
end select
else
'//分类为空。
select case action
case "1"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where name like '%"&searchkey&"%' and price2<"&jiage,conn,1,1
case "2"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where mark like '%"&searchkey&"%' and price2<"&jiage,conn,1,1
case "3"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,productdate from product where introduce like '%"&searchkey&"%' and price2<"&jiage,conn,1,1
case "4"
rs.open "select id,name,mark,introduce,pic,price1,price2,discount,detail,productdate from product where detail='"&searchkey&"' and price2<"&jiage,conn,1,1
end select
end if
end if


		  
				if err.number<>0 then
				response.write "数据库中暂时无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' > 对不起,没有查询到您需要的商品!</p>"
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=3
      				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=3 then
            			showContent
            			showpage totalput,MaxPerPage,"research.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"research.asp"
        				else
	        				currentPage=3
           					showContent
           					showpage totalput,MaxPerPage,"research.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%>
      <table width=100% border="0" align="center" cellpadding="6" cellspacing="0">
        <%do while not rs.eof%>
        <tr align="center"> 
          <td><table width="96%" border="0" align="center" cellpadding="3" cellspacing="0">
              <tr> 
                <td width="28%" valign="middle" align="center"><TABLE WIDTH="100" HEIGHT="100" BORDER="0" CELLPADDING="0" CELLSPACING="1" BGCOLOR="#cccccc">
                    <TR> 
                      <TD WIDTH="100" BGCOLOR="#FFFFFF" align="center"> <a href=product.asp?id=<% = rs("id") %> target="_blank"> 
                        <% if trim(rs("pic"))<>"" then %>
                        <img src=<% = trim(rs("pic"))%> width="<% = webimg9 %>"  height="<% = webimg10 %>" border=0 ></a> 
                        <%  else %>
                        <img src=images/emptybook.jpg  border=0> 
                        <% end if %>
                      </TD>
                    </TR>
                  </TABLE></td>
                <td width="72%"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
                    <tr> 
                      <td colspan="3"> <a href=product.asp?id=<%=rs("id")%>>商品名称:<font color="#FF6600"><%=trim(rs("name"))%></font></a></td>
                    </tr>
                    <tr> 
                      <td> 商品品牌:<%=trim(rs("mark"))%></td>
                      <td colspan="2">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td width="41%">市场价:<s>¥<%=rs("price1")%>元</s></td>
                      <td width="32%">会 员 价:<font color="#FF0000">¥</font><font color=red><%=rs("price2")%>元</font></td>
                      <td width="27%">&nbsp;</td>
                    </tr>
                    <tr> 
                      <td> <a href=# onClick="javascript:window.open('cart.asp?id=<% = rs("id") %>','','width=632,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;"><img src=images/skin/default/cart.gif width=50 height=19 align=absmiddle border=0></a> 
                      </td>
                      <td colspan="2"><a href=# onClick="javascript:window.open('addto.asp?id=<% = rs("id") %>&action=add','','width=632,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;"><img src=images/skin/default/addto.gif width=50 height=19 align=absmiddle border=0></a></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="3" colspan="2"> <table height=1 cellspacing=0 cellpadding=0 width=500 
                        align=center bgcolor=#f2f2f2 border=0 valign="top">
                    <tbody>
                      <tr> 
                        <td></td>
                      </tr>
                    </tbody>
                  </table></td>
              </tr>
            </table></td>
        </tr>
        <%i=i+1
		if i>=MaxPerPage then Exit Do
		rs.movenext
  loop
  rs.close
  set rs=nothing%>
      </table>
      <%  
				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 %>
      <form method=Post action=<% = filename %>?searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>
        <%	If CurrentPage<2 Then  %>
        首 页 上一页 
        <% Else  %>
        <div align="center"><a href=<% = filename %>?page=1&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>首 
          页</a> <a href=<% = filename %>?page=<% = CurrentPage-1 %>&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>上一页</a> 
          <%	End If
				If n-currentpage<1 Then  %>
          下一页 末 页 
          <%	Else  %>
          <a href=<% = filename %>?page=<% = (CurrentPage+1) %>&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>下一页</a> 
          <a href=<% = filename %>?page=<% = n %>&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>末 
          页</a> 
          <%	End If  %>
          第&nbsp;<b> 
          <% = CurrentPage %>
          </b>&nbsp;页 共&nbsp;<b> 
          <% = n %>
          </b>&nbsp;页 共查询到&nbsp;<b> 
          <% = totalnumber %>
          </b>&nbsp;件商品 转到第 
          <input type="text" name="page" size=2 maxlength=10 value=<% = currentpage %>>
          <input type='submit'  class='contents' value='跳转' name='cndok'>
        </div>
      </form>
      <%
				End Function  
sub sss() 
if action="1" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from keyname where keyname='"&searchkey&"' ",conn,1,3
if rs.eof and rs.bof then
rs.close
rs.open "select * from keyname",conn,1,3
rs.addnew
rs("keyname")=searchkey
rs("keyorder")=1
rs.update
rs.close
set rs=nothing
else
rs("keyorder")=rs("keyorder")+1
rs.update
rs.close
set rs=nothing
end if
end if
end sub%>
    </td>
  </tr>
</table>
<!--#include file="include/footer.asp"--> 

⌨️ 快捷键说明

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