📄 productlist.asp
字号:
<!-- #include file="conn.asp" -->
<!--#include file="webconfig.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=webname%></title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">
<!--#include file="include/top.asp" -->
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="1" bgcolor="#cccccc"></td>
<td width="220" height="100"><!-- #include file="include/left.asp" --></td>
<td width="1" bgcolor="cccccc"></td>
<td align="center">
<!--#include file="include/search.asp" -->
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="22" align="left" class="centertitle">商品列表</td>
</tr>
<tr>
<td height="1" bgcolor="cccccc"></td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="22" bgcolor="#E3F2F9" align="left">
<%
sortid=trim(request.querystring("sortid"))
sortid_len=len(sortid)
if sortid_len=3 then
sql="select * from Net008_productlist where left(sortid,3)='"&cstr(sortid)&"' and updown='1' order by adddate desc"
else
sql="select * from Net008_productlist where sortid='"&cstr(sortid)&"' and updown='1' order by adddate desc"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql ,conn,1,2
if rs.recordcount<1 then
response.write "<font color=#ff0000>无此商品信息,可能该商品已经下架了!</font></br></br></br></br>"
response.write "<a href=index.asp>[继续查看其它商品]</a>"
response.end
end if
'productsortsub=rs("productsortsub")
const maxperpage=20 '定义每一页显示的数据记录的常量
dim currentpage '定义当前页的变量
rs.pagesize=maxperpage
currentpage=request.querystring("pageid")
if currentpage="" then
currentpage=1
elseif currentpage<1 then
currentpage=1
else
currentpage=clng(currentpage)
if currentpage > rs.pagecount then
currentpage=rs.pagecount
end if
end if
'如果变量currentpage的数据类型不是数值型
'就1赋给变量currentpage
if not isnumeric(currentpage) then
currentpage=1
end if
dim totalput,n '定义变量
totalput=rs.recordcount
if totalput mod maxperpage=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
if n=0 then
n=1
end if
rs.move(currentpage-1)*maxperpage
'取得大类
if sortid_len=3 then
sql_temp="select * from Net008_productsort where sortid='"&cstr(sortid)&"'"
set rs_temp=server.createobject("adodb.recordset")
rs_temp.open sql_temp,conn,1,2
SortName_D=rs_temp("SortName")
rs_temp.close
set rs_temp=nothing
'取得小类
else
'先取大类,再取小类
sortid_D=left(sortid,3)
sql_temp="select * from Net008_productsort where sortid='"&cstr(sortid_D)&"' and sortlevel='1'"
set rs_temp=server.createobject("adodb.recordset")
rs_temp.open sql_temp,conn,1,2
SortName_D=rs_temp("SortName")&"->"
rs_temp.close
set rs_temp=nothing
sql_temp="select * from Net008_productsort where sortid='"&cstr(sortid)&"'"
set rs_temp=server.createobject("adodb.recordset")
rs_temp.open sql_temp,conn,1,2
SortName_X=rs_temp("SortName")
rs_temp.close
set rs_temp=nothing
end if
%>
<b><font color="#006699">首页>><%=SortName_D%><%=SortName_X%></font></b></td>
<td height="22" bgcolor="#E3F2F9" align="right"> 页数:<%=currentpage%>/
<% =n%>
<%k=currentpage
if k<>1 then%>
[<a href="productlist.asp?pageid=1&sortid=<%=sortid%>" class="LeftTypeLinkU">首页</a>]
[<a href="productlist.asp?pageid=<%=k-1%>&sortid=<%=sortid%>" class="LeftTypeLinkU">上一页</a>]
<%else%>
[首页] [上一页]
<%end if%>
<%if k<>n then%>
[<a href="productlist.asp?pageid=<%=k+1%>&sortid=<%=sortid%>" class="LeftTypeLinkU">下一页</a>]
[<a href="productlist.asp?pageid=<%=n%>&sortid=<%=sortid%>" class="LeftTypeLinkU">尾页</a>]
<%else%>
[下一页] [尾页]
<%end if%>
共有<font color="red"><%=totalput%></font>件商品</td>
</tr>
</tbody>
</table>
<table cellspacing=1 cellpadding=0 width="98%" border=0>
<tbody>
<%
i=0
For i = 1 To rs.PageSize/4
%>
<tr valign="top">
<td width="20%" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="center" class="producttitle">[<%=rs("productname")%>]</td>
</tr>
<tr>
<td align="center"> <table width="75" border="0" cellspacing="1" cellpadding="3" bgcolor="#cccccc">
<tr>
<td bgcolor="#FFFFFF" align="center"><a href="showproduct.asp?id=<%=rs("id")%>" target="_blank"><img src="admin/show_productimg.asp?id=<%=rs("id")%>" width="75" height="100" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center">市场价:<s>¥<%=rs("marketprice")%></s>元</td>
</tr>
<tr>
<td align="center"><font color="#FF0000">本店价:¥<%=rs("newprice")%>元</font></td>
</tr>
<tr>
<td align="center"><a href="shopping.asp?id=<%=rs("id")%>" target="_blank"><img src="images/shopcart.gif" width="74" height="23" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
<%
rs.MoveNext
If rs.EOF Then Exit For
%>
<td bgcolor="#FFFFFF" width="20%"> <table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="center" class="producttitle">[<%=rs("productname")%>]</td>
</tr>
<tr>
<td align="center"> <table width="75" border="0" cellspacing="1" cellpadding="3" bgcolor="#cccccc">
<tr>
<td bgcolor="#FFFFFF" align="center"><a href="showproduct.asp?id=<%=rs("id")%>" target="_blank"><img src="admin/show_productimg.asp?id=<%=rs("id")%>" width="75" height="100" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center">市场价:<s>¥<%=rs("marketprice")%></s>元</td>
</tr>
<tr>
<td align="center"><font color="#FF0000">本店价:¥<%=rs("newprice")%>元</font></td>
</tr>
<tr>
<td align="center"><a href="shopping.asp?id=<%=rs("id")%>" target="_blank"><img src="images/shopcart.gif" width="74" height="23" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
<%
rs.MoveNext
If rs.EOF Then Exit For
%>
<td bgcolor="#FFFFFF" width="20%"> <table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="center" class="producttitle">[<%=rs("productname")%>]</td>
</tr>
<tr>
<td align="center"> <table width="75" border="0" cellspacing="1" cellpadding="3" bgcolor="#cccccc">
<tr>
<td bgcolor="#FFFFFF" align="center"><a href="showproduct.asp?id=<%=rs("id")%>" target="_blank"><img src="admin/show_productimg.asp?id=<%=rs("id")%>" width="75" height="100" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center">市场价:<s>¥<%=rs("marketprice")%></s>元</td>
</tr>
<tr>
<td align="center"><font color="#FF0000">本店价:¥<%=rs("newprice")%>元</font></td>
</tr>
<tr>
<td align="center"><a href="shopping.asp?id=<%=rs("id")%>" target="_blank"><img src="images/shopcart.gif" width="74" height="23" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
<%
rs.MoveNext
If rs.EOF Then Exit For
%>
<td bgcolor="#FFFFFF" width="20%"> <table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="center" class="producttitle">[<%=rs("productname")%>]</td>
</tr>
<tr>
<td align="center"> <table width="75" border="0" cellspacing="1" cellpadding="3" bgcolor="#cccccc">
<tr>
<td bgcolor="#FFFFFF" align="center"><a href="showproduct.asp?id=<%=rs("id")%>" target="_blank"><img src="admin/show_productimg.asp?id=<%=rs("id")%>" width="75" height="100" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center">市场价:<s>¥<%=rs("marketprice")%></s>元</td>
</tr>
<tr>
<td align="center"><font color="#FF0000">本店价:¥<%=rs("newprice")%>元</font></td>
</tr>
<tr>
<td align="center"><a href="shopping.asp?id=<%=rs("id")%>" target="_blank"><img src="images/shopcart.gif" width="74" height="23" border="0" align="absmiddle"></a></td>
</tr>
</table></td>
</tr>
<%
rs.MoveNext
If rs.EOF Then Exit For
response.write "<tr><td colspan='5' background=../images/bg1.gif height=1></td></tr>"
next
%>
</tbody>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="22" bgcolor="#E3F2F9" align="left"> <b><font color="#006699">首页>><%=SortName_D%><%=SortName_X%></font></b></td>
<td height="22" bgcolor="#E3F2F9" align="right"> 页数:<%=currentpage%>/
<% =n%>
<%k=currentpage
if k<>1 then%>
[<a href="productlist.asp?pageid=1&sortid=<%=sortid%>" class="LeftTypeLinkU">首页</a>]
[<a href="productlist.asp?pageid=<%=k-1%>&sortid=<%=sortid%>" class="LeftTypeLinkU">上一页</a>]
<%else%>
[首页] [上一页]
<%end if%>
<%if k<>n then%>
[<a href="productlist.asp?pageid=<%=k+1%>&sortid=<%=sortid%>" class="LeftTypeLinkU">下一页</a>]
[<a href="productlist.asp?pageid=<%=n%>&sortid=<%=sortid%>" class="LeftTypeLinkU">尾页</a>]
<%else%>
[下一页] [尾页]
<%end if%>
共有<font color="red"><%=totalput%></font>件商品</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"> </td>
</tr>
</table> </td>
<td width="1" bgcolor="cccccc"></td>
</tr>
</table>
<!-- #include file="include/bottom.asp" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -