我用JS+Cookie编写的购物车,(添加、修改过程在客户端执行,一次提交服务器,IE适用)
一、商品列表:list.htm
<html>
<head>
<title>新</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE = "JavaScript" src="orderform_functions.js"></SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<form name="form1" method="post" action="">
<div align="center"><a href="orderform.htm">我的订单</a><br>
</div>
<table width="80%" border="1" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0001" type="text" name="0001" size="4" value="1" maxlength="5" >
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma001','商品ma001',a0001.value,'46.00')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0002" type="text" name="0002" size="4" value="1">
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma002','商品ma002',a0002.value,'146.00')">
</td>
</tr>
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0003" type="text" name="0003" size="4" value="1">
<input type="button" name="Button3" value="添加" onClick="SetOrderForm('ma003','商品ma003',a0003.value,'1000.60')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0004" type="text" name="0004" size="4" value="1">
<input type="button" name="Button4" value="添加" onClick="SetOrderForm('ma004','商品ma004',a0004.value,'5.50')">
</td>
</tr>
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0005" type="text" name="0001" size="4" value="1" maxlength="5" >
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma005','商品ma005',a0005.value,'46.00')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0006" type="text" name="0002" size="4" value="1">
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma006','商品ma006',a0006.value,'146.00')">
</td>
</tr>
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0007" type="text" name="0003" size="4" value="1">
<input type="button" name="Button3" value="添加" onClick="SetOrderForm('ma007','商品ma007',a0007.value,'1000.60')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0008" type="text" name="0004" size="4" value="1">
<input type="button" name="Button4" value="添加" onClick="SetOrderForm('ma008','商品ma008',a0008.value,'5.50')">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<title>新</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE = "JavaScript" src="orderform_functions.js"></SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<form name="form1" method="post" action="">
<div align="center"><a href="orderform.htm">我的订单</a><br>
</div>
<table width="80%" border="1" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0001" type="text" name="0001" size="4" value="1" maxlength="5" >
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma001','商品ma001',a0001.value,'46.00')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0002" type="text" name="0002" size="4" value="1">
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma002','商品ma002',a0002.value,'146.00')">
</td>
</tr>
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0003" type="text" name="0003" size="4" value="1">
<input type="button" name="Button3" value="添加" onClick="SetOrderForm('ma003','商品ma003',a0003.value,'1000.60')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0004" type="text" name="0004" size="4" value="1">
<input type="button" name="Button4" value="添加" onClick="SetOrderForm('ma004','商品ma004',a0004.value,'5.50')">
</td>
</tr>
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0005" type="text" name="0001" size="4" value="1" maxlength="5" >
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma005','商品ma005',a0005.value,'46.00')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0006" type="text" name="0002" size="4" value="1">
<input type="button" name="Button6" value="添加" onClick="SetOrderForm('ma006','商品ma006',a0006.value,'146.00')">
</td>
</tr>
<tr>
<td width="48%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0007" type="text" name="0003" size="4" value="1">
<input type="button" name="Button3" value="添加" onClick="SetOrderForm('ma007','商品ma007',a0007.value,'1000.60')">
</td>
<td width="52%"><img src="images/mer.png" width="100" height="100">数量
<input id="a0008" type="text" name="0004" size="4" value="1">
<input type="button" name="Button4" value="添加" onClick="SetOrderForm('ma008','商品ma008',a0008.value,'5.50')">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>