📄 class.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="include/header.asp"-->
<title><%=webname%>--商品分类</title>
<%
dim sortsid,i,strsql,strcat,strsorts,catid
catid = KillBad(trim(request.QueryString("aid")))
sortsid=KillBad(trim(request.querystring("nid")))
if catid="" then
response.Redirect "procat.asp"
response.end
end if
if sortsid="" then
response.Redirect "cat.asp?catid=27"
response.end
end if
set rs = server.CreateObject("adodb.recordset")
rs.open "select category from category where categoryid="&catid&" ",conn,1,1
strcat = rs("category")
rs.close
if sortsid<>"" then
rs.open "select sorts from sorts where sortsid="&sortsid&" ",conn,1,1
strsorts = rs("sorts")
rs.close
end if
%>
<table WIDTH="760" BORDER="0" CELLSPACING="0" CELLPADDING="0" align="center" class=table-zuoyou>
<tr><td>
<TABLE width="100%" class=table-xia>
<tr><td height="30" bgcolor="<% = bgclr1 %>" width="75"> <font color="#FFFFFF"><b>您的位置:</b></font></td>
<td bgcolor="#FFFFFF"> <a href="index.asp"><b><%=webname%></b></a>-><a href=cat.asp?catid=<% = catid %>><b><%=strcat %></b></a>-><a href=class.asp?aid=<% = catid %>&nid=<% = sortsid %>><b><%=strsorts %></a></b></td></tr>
</table><table>
<TR><TD width="180" valign="top">
<table class=table-you>
<tr><td width="180" class=table-xia><!--#include file="include/cat.asp"--></td></tr>
<tr><td class=table-xia><!--#include file="include/classnew.asp"--></td></tr>
<tr>
<td align="center" class=table-xia><A HREF=<%=zuo1url%> TARGET="_blank"><IMG SRC=<%=zuo1%> BORDER="0" WIDTH="165"></A></td>
</tr>
<tr><td class=table-xia><!--#include file="include/classsold.asp"--></td></tr>
<tr>
<td align="center" class=table-xia><A HREF=<%=zuo2url%> TARGET="_blank"><IMG SRC=<%=zuo2%> BORDER="0" WIDTH="165"></A></td>
</tr>
<tr><td class=table-xia><!--#include file="include/classhot.asp"--></td></tr>
<tr>
<td align="center" class=table-xia><A HREF=<%=zuo3url%> TARGET="_blank"><IMG SRC=<%=zuo3%> BORDER="0" WIDTH="165"></A></td>
</tr>
<tr><td class=table-xia><!--#include file="include/classdis.asp"--></td></tr>
<tr><td class=table-xia><!--#include file="include/classrec.asp"--></td></tr>
<tr>
<td align="center" class=table-xia><A HREF=<%=zuo4url%> TARGET="_blank"><IMG SRC=<%=zuo4%> BORDER="0" WIDTH="170"></A></td>
</tr>
</table>
<td align="center" valign="top" width="580">
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td valign="top">
<%
Const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request.QueryString("page")) then
currentPage=Cint(request.QueryString("page"))
else
currentPage=1
end if
set rs = server.CreateObject("adodb.recordset")
if sortsid="" then
rs.open "select id,pic,prename,name,company,mark,pretype,type,intro,introduce,predate,productdate,viewnum,other,grade,price1,price2,discount from product where categoryid="&catid&" order by adddate desc",conn,1,1
else
rs.open "select id,pic,prename,name,company,mark,pretype,type,intro,introduce,predate,productdate,viewnum,other,grade,price1,price2,discount from product where sortsid="&sortsid&" order by adddate desc",conn,1,1
end if
if err.number<>0 then
response.write "数据库中暂时无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 对不起,此分类暂时还没有商品!</p>"
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,"class.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"class.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"class.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><% do while not rs.eof%>
<table width="96%" border="0" align="center" cellpadding="3" cellspacing="0" class=table-xia>
<tr><td width="20%" 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"))%> border=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></a>
<% else %>
<img src=images/emptybook.jpg border=0 width="<% = webimg9 %>" height="<% = webimg10 %>"></a>
<% end if %>
</TD></TR>
</TABLE>
</td>
<td width="80%">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
<tr><td colspan="3">
<% = trim(rs("prename")) %>
<a href=product.asp?id=<%=rs("id")%>><font color="#FF0000"><%=trim(rs("name"))%></font></a></td>
</tr>
<tr>
<td> <%=trim(rs("company"))%><%=trim(rs("mark"))%></td>
<td colspan="2"><%=trim(rs("pretype"))%><%=trim(rs("type"))%></td>
</tr>
<tr>
<td colspan="3"><%=trim(rs("intro"))%><%=trim(rs("introduce"))%></td>
</tr>
<tr>
<td> <%=trim(rs("predate"))%><%=trim(rs("productdate"))%></td>
<td>浏览次数:<%=trim(rs("viewnum"))%></td>
<td><%=trim(rs("other"))%><%=trim(rs("grade"))%></td>
</tr>
<tr>
<td width="33%">市场价:<S>¥<%=rs("price1")%>元</S></td>
<td width="34%">会 员 价:<FONT COLOR="#FF0000">¥</FONT><font color=red><%=rs("price2")%>元</font></td>
<td width="33%">折扣:<%=rs("discount")*10%>折</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 colspan="2" height="10"></td>
</tr>
</table>
<%
i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing
%>
</td>
</tr>
</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 %>?nid=<% = sortsid %>&aid=<% = catid %>>
<p align='center'>
<%
If CurrentPage<2 Then %>
首页 上页
<%
Else %>
<a href=<% = filename %>?page=1&nid=<% = sortsid %>&aid=<% = catid %>>首页</a>
<a href=<% = filename %>?page=<% = CurrentPage-1 %>&nid=<% = sortsid %>&aid=<% = catid %>>上页</a>
<%
End If
If n-currentpage<1 Then %>
下页 末页
<%
Else %>
<a href=<% = filename %>?page=<% = (CurrentPage+1) %>&nid=<% = sortsid %>&aid=<% = catid %>>下页</a>
<a href=<% = filename %>?page=<% = n %>&nid=<% = sortsid %>&aid=<% = catid %>>末页</a>
<%
End If %>
第 <b><% = CurrentPage %></b> 页 共 <b><% = n %></b> 页
共 <b><% = totalnumber %></b> 件商品 每页 <b><% = maxperpage %></b> 件商品
转到第:<input type='text' name='page' size=2 maxlength=10 class=smallInput value=<% = currentpage %>>
页<input type='submit' class='contents' value='跳转' name='cndok'></form>
<%
End Function
%>
</td>
</tr>
</table> </td>
</tr>
</table></td></tr></table>
<!--#include file="include/footer.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -