本文实例为大家分享了jQuery实现购物车结算功能展示的具体代码,供大家参考,具体内容如下
/*删除*/
$(function(){
$(".blue").bind("click",function(){
$(this).parent().parent().remove();
totalPrice();
});
/*当鼠标离开文本框时,获取当前值,调用totalPrice()函数进行结算*/
$(".shopping_product_list_5 input").bind("blur",function(){
var t = $(this).val();
totalPrice();
});
var allPrice = 0;
var allReduce = 0;
var allCount = 0;
$("#myTableProduct tr").each(function(){ /*循环购物车列表的每一行*/
var num = parseInt($(this).find(".shopping_product_list_5 input").val()); /*获取文本框中数量值*/
var price = parseFloat($(this).find(".shopping_product_list_4 label").text()); /* 获取商品价格*/
var total = price * num;
allPrice += total; /*计算所有商品的总价格*/</