ASP 网站如何加入按价格查询整个网站产品,分别加入“从低到高”和“从高到低”?找热心人帮忙!
ASP网站如何加入按价格查询整个网站产品,分别加入“从低到高”和“从高到低”?找热心人帮忙!我完全是新手,新得连现成的源码大部分都读不懂,恳请老师们帮帮忙?谢谢!
源码如下,如何在里面添加 “从低到高”和“从高到低”这两个产品价格查询功能??
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<html>
<head>
<title><%=webname%>--报价中心</title>
<LINK href="images/css1.css" type=text/css rel=stylesheet>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="head.asp"-->
<table width="980" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" class="menuer_linebg"></td>
</tr>
</table>
<table width="980" height="200" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="15"></td>
<td width="206" valign="top"><!--#include file="userinfo.asp"-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="15"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="15"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/box_smtop.gif" width="200" height="28"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
</table>
<TABLE style="PADDING-TOP: 10px" cellSpacing=0 cellPadding=0 width="102%"
align=center border=0>
<TBODY>
<TR>
<TD align="center" class="box3"><!--#include file="include/sort.asp"-->
</TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
</table></td>
<td width="15"></td>
<td width="744" valign="top"><table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" bordercolor="#CCCCCC">
<tr>
<td height="28" valign="middle" background="images/bgpr.gif" bgcolor="#f1f1f1"> <a href=index.asp><%=webname%></a> >> <a href="price.asp">报价中心</a> </td>
</tr>
<tr>
<td width="700" valign="top"><table cellspacing=0 cellpadding=0 width=100% align=center border=0>
<tbody>
<tr>
<td class=b valign=top align=left width=100% >
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" bordercolor="#CCCCCC">
<tr>
<td width="100%" align="center" valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" height="28" background="skin/skin<%=skinid%>/pdbg01.gif"> </td>
</tr>
<tr bgcolor="#ffffff">
<td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%
anid=trim(request("anid"))
%>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" dwcopytype="CopyTableCell">
<tr>
<td align=center><span class="style2">
<a href="price.asp">全部商品</a> <% set rs=server.CreateObject("adodb.recordset")
rs.open "select * from bsort order by anclassidorder asc",conn,1,1
do while not rs.eof
response.write "<img src='images/ring01.gif'> <A href=?anid="&rs("anclassid")&">"&trim(rs("anclass"))&"</a> "
rs.movenext
loop
rs.close
set rs=Nothing
%>
</span></td>
</tr>
</table><%
Const MaxPerPage=20
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 anid<>"" then
rs.open "select * from products where anclassid="&anid&" order by adddate desc",conn,1,1
else
select case selectm
case ""
rs.open "select * from products order by adddate desc",conn,1,1
case "0"
rs.open "select * from products order by adddate desc",conn,1,1
case "shopid"
end select
end if
if rs.eof And rs.bof then
Response.Write "<p align='center'>此分类下暂无商品!</p>"
%>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</td>
<td ></td>
</tr>
</tbody>
</table>
<%
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
showContent
showpage totalput,MaxPerPage,"Price.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim shopmark
shopmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"Price.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"Price.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</td>
<td ></td>
</tr>
</tbody>
</table>
<form name="form1" method="post" action="">
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999">
<tr bgcolor="#C7D3E6">
<td height="28" align="center" bgcolor="#F7F7F7">商品序号</td>
<td height="28" align="center" bgcolor="#F7F7F7">商品名称</td>
<td height="28" align="center" bgcolor="#F7F7F7">市场价</td>
<td height="28" align="center" bgcolor="#F7F7F7">会员价</td>
<td height="28" align="center" bgcolor="#F7F7F7">VIP价</td>
<td height="28" align="center" bgcolor="#F7F7F7">当前库存</td>
<td height="28" align="center" bgcolor="#F7F7F7">商品品牌</td>
<td height="28" align="center" bgcolor="#F7F7F7">规格</td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#F0F3F8">
<td height="23" align="center" bgcolor="#FFFFFF"><%=rs("bookid")%></td>
<td height="18" align="left" bgcolor="#FFFFFF" style='PADDING-LEFT: 10px'><img src="images/price_ico.png" width="11" height="11" />
<a href=products.asp?id=<%=rs("bookid")%> target="_blank">
<%
if len(trim(rs("bookname")))>28 Then
response.write left(trim(rs("bookname")),28)&".."
Else
response.write trim(rs("bookname"))
End If
%>
</a></td>
<td height="18" align="center" bgcolor="#FFFFFF"><s><%=rs("shichangjia")%>元</s></td>
<td height="18" align="center" bgcolor="#FFFFFF"><%=rs("huiyuanjia")%>元</td>
<td height="18" align="center" bgcolor="#FFFFFF"> <%if Request.Cookies("cnhww")("reglx")=2 then%>
<%=rs("vipjia")%>元
<%else%>
<font color="#FF3333">VIP可见</font>
<%end if%></td>
<td height="18" align="center" bgcolor="#FFFFFF"><%=rs("kucun")%></td>
<td height="18" align="center" bgcolor="#FFFFFF"><%=rs("pingpai")%></td>
<td height="18" align="center" bgcolor="#FFFFFF"><%=rs("isbn")%></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
Loop
rs.close
set rs=Nothing
%>
</table>
</form>
<%
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&"?selectm="&selectm&"&selectkey="&selectkey&" >"
Response.Write "<p align='center'> "
If CurrentPage<2 Then
Response.Write "首页 上一页 "
Else
Response.Write "<a href="&filename&"?page=1&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">上一页</a> "
End If
If n-currentpage<1 Then
Response.Write "下一页 尾页"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">"
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&anid="&anid&"&selectm="&selectm&"&selectkey="&selectkey&">尾页</a>"
End If
Response.Write " 页次:"&CurrentPage&"/"&n&"页 "
Response.Write " 共有"&totalnumber&"种商品 "
Response.Write "转到:<input type='text' name='page' size=2 maxlength=10 value="¤tpage&">"
Response.Write " <input type='submit' value='GO' name='cndok'></form>"
End Function
%> </td>
</tr>
</table></td>
<td width="24"> </td>
</tr>
</table>
<!--#Include file="end.asp"-->
</body>
</html>
[ 本帖最后由 xny198482 于 2014-6-10 21:27 编辑 ]