日期:2014-05-17 浏览次数:20770 次
function changeQuantity(input,id,oldvalue){
alert(1);
var quantity = input.value; //得到要修改的数量 sdfsfs
//检查用户输入的数量是不是一个正整数
if(quantity<0 || quantity!=parseInt(quantity)){
alert("请输入正整数!!");
input.value = oldvalue;
return;
}
var b = window.confirm("您确认把书的数量修改为:" + quantity);
if(b){
window.location.href="${pageContext.request.contextPath}/client/UpdateListCartServlet?id=" + id + "&quantity=" + quantity;
}
}
<table>
<c:forEach var="entry" items="${cart.map}">
<td><input type="text" name="quantity" value="${entry.value.quantity }" style="width:35px" onchange="changeQuantity(this,${entry.key },${entry.value.quantity } )" /></td>
</c:forEach>
</table>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>购物车列表页面</title>
<script type="text/javascript">
function changeQuantity(input,id,oldvalue){
var quantity = input.value; //得到要修改的数量 sdfsfs
//检查用户输入的数量是不是一个正整数
if(quantity<0 || quantity!=parseInt(quantity)){
alert("请输入正整数!!");
input.value = oldvalue;
return;
}
var b = window.confirm("您确认把书的数量修改为:" + quantity);
if(b){
window.location.href="${pageContext.request.contextPath}/servlet/ChangeQuantityServlet?id=" + id + "&quantity=" + quantity;
}
}
</script>
</head>
<body style="text-align: center">
<%@include file="/client/head.jsp" %>
<br/><br/>
<c:if test="${empty(cart.map)}">
您没有购买任何商品!!!
</c:if>
<c:if test="${!empty(cart.map)}">
&nb