📄 shoppingcart.asp
字号:
<!-- #include file="odbc_connection.asp" -->
<!-- #include file="function1.asp" -->
<html>
<head>
<title>购物车</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<meta http-equiv="expires" content="0">
</head>
<body>
<h2 align="center">您的购物车</h2>
<form method="post" action="updatebook.asp">
<table align="center" border="1" width="90%" bgcolor="#F4F4A8" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" cellspacing="0" cellpadding="0">
<tr align=center>
<th width="10%">编号</th>
<th width="50%">名称</th>
<th width="10%">单价</th>
<th width="10%">数量</th>
<th width="10%">小计</th>
<th width="10%">删除</th>
</tr>
<%
Dim Books,BooksNum,numTemp,sum
Books=Session("Books")
BooksNum=Session("BooksNum")
sum=0
If IsArray(Books)=True Then
'这表示它是数组,说明其中有书
numTemp=Ubound(Books)
Dim I,rs,strSql
'下面逐本书显示
For I=0 To numTemp
'需要从Book表中返回名称、价格等信息
strSql="Select * From book Where BookId=" & Books(I)
Set rs=db.Execute(strSql)
%>
<tr align=center>
<td><%=rs("bookID")%></td>
<td><%=rs("bookname")%></td>
<td><%=FormatCurrency(rs("bookprice"))%></td>
<td>
<input type="text" value="<%=BooksNum(I)%>" name="num<%=I%>" size="2">
</td>
<td><%=FormatCurrency(booksnum(I)*rs("bookprice"))%></td>
<td><a href="delbook.asp?BookId=<%=Books(I)%>">删除</a></td>
</tr>
<%
sum=sum+booksnum(I)*rs("bookprice") '统计总金额
Next%>
<%
rs.Close
Set rs=Nothing
End If%>
<tr align=center>
<!--注释:FormatCurrency是格式化函数-->
<td colspan="4">总计</td><td><%=FormatCurrency(sum)%></td><td> </td>
</tr>
</table>
<p></p>
<div align=center>
<input type="button" value="返回继续购物" onClick="javascript:window.close()">
<%If sum>0 Then%>
<input type="submit" value="确认数量修改">
<input type="button" value="收银台" onClick="javascript:top.location='login.asp'">
<%End If%>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -