web如何实现批量购买勾选的同时显示合计数
$(function(){ $("#selected").click(function(){ $("input[name='rules[]']").each(function(){ $(this).prop('checked', true); }); }); $("#cancel").click(function(){ $("input[name='rules[]']").each(function(){ $(this).prop('checked', false); }); }); });
---
这是批量购买。。
{$key+1} {$vo.username} {$vo.price} {$vo.num} {$vo.addtime|date="Y-m-d H:i:s",###} {$vo.pricenum} $vo['id']))}" class="action">购买 $("#checkall").click(function(){ $("input[name='oid[]']").each(function(){ this.checked = true; }); docal(); }); $("#checkallno").click(function(){ $("input[name='oid[]']").each(function(){ this.checked = false; }); $('#total_pv').html('0'); $('#total_dg').html('0'); }); // 计算 function docal(){ var formData = $('#ajaxForm').serialize(); // jQuery.post(url,data,success(data, textStatus, jqXHR),dataType) $.ajax({ type: 'POST', url: "{:U('Points/docal')}", data: formData, dataType: 'json', success: function(re){ if(re.code == 1){ // 返回总数量,总金额 // layer.alert(re.cal.num); $('#total_pv').html(re.cal.num); $('#total_dg').html(re.cal.usedgcash); } }, error:function(){ layer.alert('error'); } }); return false; } // 当选择框被点选取时。 $("input[id*='oid']").change(function() { /*alert($(this).attr("id")); alert($(this).val());*/ docal(); }); $(".action").click(function(){ var buyLink=$(this).attr("link"),$this = $(this); layer.confirm('你确定要购买吗?',{title:'操作提示'}, function(index){ $.post(buyLink,function(data){ if(data.code == 1){ layer.alert(data.message, function(){ window.location.reload(); }); }else{ layer.alert(data.message); } }); layer.close(index); }); }); });主要是这个 change,找了很久哇。
关于“web如何实现批量购买勾选的同时显示合计数”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
文章标题:web如何实现批量购买勾选的同时显示合计数
网页URL:http://scpengxi.com/article/gpeish.html