📄 goodslist.asp
字号:
<!--#include File="../ConnDB.asp"-->
<!--#include file="isAdmin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品管理</title>
<link href="../style.css" rel="stylesheet">
<script language="javascript">
function newwin(url) {
var oth="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=200,top=200";
oth = oth+",width=500,height=400";
var newwin=window.open(url,"newwin",oth);
newwin.focus();
return false;
}
function SelectChk()
{
var s=false;
var goodsid,n=0;
var strid,strurl;
var nn = self.document.all.item("goods")
for (j=0;j<nn.length;j++)
{
if (self.document.all.item("goods",j).checked)
{
n = n + 1;
s=true;
goodsid = self.document.all.item("goods",j).id+"";
if(n==1)
{
strid = goodsid;
}
else
{
strid = strid + "," + goodsid;
}
}
}
strurl = "GoodsDelt.asp?id=" + strid;
if(!s) {
alert("请选择要删除的商品!");
return false;
}
if ( confirm("你确定要删除这些商品吗?")) {
form1.action = strurl;
form1.submit();
}
}
function sltAll()
{
var nn = self.document.all.item("goods");
for(j=0;j<nn.length;j++)
{
self.document.all.item("goods",j).checked = true;
}
}
function sltNull()
{
var nn = self.document.all.item("goods");
for(j=0;j<nn.length;j++)
{
self.document.all.item("goods",j).checked = false;
}
}
</script>
</head>
<body link="#000080" vlink="#080080">
<form id="form1" name="form1" method="POST">
<p align="center"><font color="#000080"><b><font style="font-size: 12pt">商 品
管 理</font></b></font></p><BR>
<%
'读取当前商品类别编号
typeid = CLng(Request("typeid"))
If typeid < 0 Then
typeid = 0
End If
Dim rs
Set rs = Server.CreateObject("ADODB.RecordSet")
'读取商品类别
sql = "SELECT * FROM GoodsType ORDER BY Id"
rs.Open sql,Conn,1,1
If rs.EOF Then
Response.Write("没有商品类别")
Else
Do While Not rs.EOF
If rs("id") = typeid Then
Response.Write(rs("Type"))
Else
Response.Write("<a href='GoodsList.asp?typeid=" & Trim(rs("id")) & "'>" & Trim(rs("Type")) & "</a>")
End If
Response.Write(" | ")
rs.MoveNext
Loop
End If
%>
<table align=center border="1" cellspacing="0" width="100%" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF" style='FONT-SIZE: 9pt'>
<tr>
<td width="6%" align="center" bgcolor="#FFFFCC"><strong>编号</strong></td>
<td width="22%" align="center" bgcolor="#FFFFCC"><strong>名称</strong></td>
<td width="16%" align="center" bgcolor="#FFFFCC"><strong>销售价格</strong></td>
<td width="8%" align="center" bgcolor="#FFFFCC"><strong>销售数量</strong></td>
<td width="8%" align="center" bgcolor="#FFFFCC"><strong>阅读次数</strong></td>
<td width="10%" align="center" bgcolor="#FFFFCC"><strong>修改</strong></td>
<td width="10%" align="center" bgcolor="#FFFFCC"><strong>选择</strong></td>
</tr>
<%
rs.Close
'设置SQL语句,读取当前指定商品类别中的所有商品列表
If typeid=0 Then
sql = "SELECT * FROM Goods ORDER BY Posttime"
Else
sql = "SELECT * FROM Goods WHERE TypeId = " & Trim(typeid) & " ORDER BY Posttime"
End If
rs.Open sql,Conn,1,1
If rs.EOF Then
Response.Write "<tr><td colspan=8 align=center>目前还没有商品。</td></tr></table>"
Else
'设置每页显示记录的数量
rs.PageSize = 15
'读取参数page,表示当前页码
iPage = CLng(Request("page"))
If iPage > rs.PageCount Then
iPage = rs.PageCount
End If
If iPage <= 0 Then
iPage = 1
End If
rs.AbsolutePage = iPage
For i=1 To rs.PageSize
n = n + 1
%>
<tr><td align="center"><%=n%></td>
<td><a href="../GoodsView.asp?id=<%=rs("id")%>" onClick="return newwin(this.href)"><%=rs("Name")%></a></td>
<td align="center"><%=rs("SalePrice")%></td>
<td align="center"><%=rs("BuyCount")%></td>
<td align="center"><%=rs("ReadCount")%></td>
<td align="center"><a href="GoodsEdit.asp?id=<%=rs("id")%>" onClick="return newwin(this.href)">修改</a></td>
<td align="center"><input type="checkbox" name="goods" id="<%=rs("id")%>" style="font-size: 9pt"></td></tr>
<%
rs.MoveNext()
If rs.EOF Then
Exit For
End If
Next
%>
</table>
<%
'显示页码
If rs.PageCount>1 Then
Response.Write "<table border='0'>"
Response.Write "<tr>"
Response.Write "<td><b>分页:</b></td>"
For i=1 To rs.PageCount
Response.Write "<td><a href='GoodsList.asp?typeid=" & Trim(typeid) & "&page=" & i & "'>"
Response.Write "[<b>" & i & "</b>]</a></td>"
Next
Response.Write "</tr></table>"
End If
End If
%>
<p align="center">
<input type="button" value="添加商品" onclick="newwin('GoodsAdd.asp')" name=add>
<input type="button" value="全 选" onclick="sltAll()" name=button1>
<input type="button" value="清 空" onclick="sltNull()" name=button2>
<input type="submit" value="删 除" name="tijiao" onclick="SelectChk()">
<br><br>
<input type=hidden name="goods">
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -