购物车前台页面代码, 这只是个小例子, 具体可以自由发挥nbsp;html><br>
<br>
<br>
<meta>
<br>
<title>购物车自动计价</title>
<br>
<script></script><br>
<script><br />
$(function(){<br />
$(".se").change(function(oEven) {<br />
var num = $(this).find("option:selected").text();<br />
var price = $(this).parent().next().text();<br />
$(this).parent().next().next().text(num*price);<br />
GetInAll();//计算所有物品价格<br />
});<br />
})<br />
<br />
function GetInAll()<br />
{<br />
var len = $("#PriceTable tbody").children("tr").length;<br />
var priceCount=0;<br />
for(var i=0;i<len;i++)<br />
{<br />
// var tempData=rows[i];<br />
var price1 = $("#PriceTable tbody tr:eq("+i+") td:eq(4)").text();<br />
priceCount=parseFloat(priceCount)+parseFloat(price1);<br />
}<br />
$("#PriceTable tfoot tr td:eq(1)").text(priceCount);<br />
}<br />
</script><br>
<style><br />
table input[type=text]{ width:32px;}<br />
</style>
<br>
<br>
<br>
<br>
<div>
<br>
<table>
<br>
<thead><tr>
<td>物品编号</td>
<td>物品名称</td>
<td>数量</td>
<td>价格</td>
<td>小计</td>
</tr></thead>
<br>
<tbody>
<br>
<tr>
<br>
<td>jsp_123</td>
<br>
<td>电脑</td>
<br>
<td>
<br>
<select><br>
<option>1</option>
<br>
<option>2</option>
<br>
<option>3</option>
<br>
<option>4</option>
<br>
<option>5</option>
<br>
</select><br>
</td>
<br>
<td>1950</td>
<br>
<td>1950</td>
<br>
</tr>
<br>
<tr>
<br>
<td>jsp_123</td>
<br>
<td>电脑</td>
<br>
<td>
<br>
<select><br>
<option>1</option>
<br>
<option>2</option>
<br>
<option>3</option>
<br>
<option>4</option>
<br>
<option>5</option>
<br>
</select><br>
</td>
<br>
<td>1950</td>
<br>
<td>1950</td>
<br>
</tr>
<br>
<tr>
<br>
<td>jsp_123</td>
<br>
<td>电脑</td>
<br>
<td>
<br>
<select><br>
<option>1</option>
<br>
<option>2</option>
<br>
<option>3</option>
<br>
<option>4</option>
<br>
<option>5</option>
<br>
</select><br>
</td>
<br>
<td>1950</td>
<br>
<td>1950</td>
<br>
</tr>
<br>
<br>
</tbody>
<br>
<tfoot>
<br>
<tr>
<td>总计:</td>
<td>5850</td>
</tr>
<br>
</tfoot>
<br>
</table>
<br>
</div>
<br>
<input><br>
<br>
AD:真正免费,域名+虚机+企业邮箱=0元