📄 cart.jsp
字号:
<%@ page contentType="text/html;charset=gbk"%>
<%@ page import="cart.buyList"%>
<%@ page import="java.util.Vector"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>订单添加页</title>
</head>
<link href="../images/style.css" rel="stylesheet">
<body>
<table width="800" height="488" border="0" align="center"
style="BORDER-TOP: #60A8E1 2px solid;BORDER-BOTTOM: #60A8E1 2px solid;BORDER-COLLAPSE: collapse"
cellpadding="0" cellspacing="0" background="../images/bag_7.gif">
<form action="clear.jsp" method="post" name="form1">
<tr>
<td height="429" valign="top">
<table width="800" height="178" border="0" align="center"
cellpadding="0" cellspacing="00" background="../images/bag_7.gif">
<tr align="center" valign="middle">
<td height="27" colspan="6" nowrap background="images/bag_2.gif"
class="bgcolor">
<font color="#FF0000"> <%
if (session.getAttribute("user") == null) {
out.println("您还没有登录");
} else {
out.println(session.getAttribute("user"));
}
%> </font> ,您的购物情况如下:(注:如果想删除商品,将数量置零后点击修改。)
</td>
</tr>
<tr align="center" valign="middle" bgcolor="#FCBE3F">
<td height="20" colspan="6" nowrap
background="../images/bag_5.gif" class="head">
</td>
</tr>
<tr align="center" valign="middle" class="bgcolor">
<td height="18" colspan="6" background="../images/bag_6.gif">
</td>
</tr>
<%
Vector shop = (Vector) session.getAttribute("shop");
double num = 0;
double pric = 0;
if (shop == null || shop.size() == 0) {
%>
<script language="javascript">
alert("购物车中没有图书");
window.location.href="../bookinfo/book.jsp";
</script>
<%
} else {
for (int i = 0; i < shop.size(); i++) {
buyList mylist = (buyList) shop.elementAt(i);
num = num + mylist.number * mylist.price;
%>
<tr align="center" valign="middle" class="bgcolor">
<td width="45" height="21">
</td>
<td width="98" height="21">
<%=i + 1%>
</td>
<td width="204" height="21">
<%=mylist.bookname%>
</td>
<td width="138" height="21">
¥
<%=mylist.price%>
</td>
<td width="147" height="21">
<input name="num<%=i%>" size="7" type="text" class="txt_grey"
value="<%=mylist.number%>">
</td>
<td width="168" height="21">
¥
<%=(mylist.price * mylist.number)%>
</td>
<script language="javascript">
<!--
function check(){
if(isNaN(form1.num<%=i%>.value)){
alert("请不要输入非法字符");
return false;
history.back();
}
if(form1.num<%=i%>.value==""){
alert("请输入修改的数量");
return false;
history.back();
}
}
-->
</script>
<%
}
}
%>
<tr align="center" valign="middle" class="bgcolor">
<td height="21" colspan="5">
</hr>
</td>
<td height="21" align="left">
<FONT color="#ff0000"> 总合计金额:¥ <%=num%> </FONT>
</td>
</table>
</td>
</tr>
<tr>
<td height="59" align="center" valign="top"
background="../images/bag_8.gif">
<input name="Submit" type="button" value="返回" class="btn_grey"
onclick="javascript:location.href='../logindindex.jsp';">
<a href="../index.jsp"> </a>
<a href="../bookinfo/book.jsp"> <input name="Submit"
type="submit" class="btn_grey" value="修改"
onClick="return check()"> 继续购物 </a> |
<a href="putin.jsp"> 清空购物车 </a> |
<a href="../orderlist/index_order.jsp?buy3=<%=num%>"> 收银台 </a>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -