作者 anyv
1 个管道 的构建 通过 耗费 0 秒

1

... ... @@ -132,6 +132,41 @@
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
// 计算总计
function calcTotal() {
var checkBoxes = $(".sh_cartround img");
var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");
var countInputs = $(".order_newsNum .order_newsnum");
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < priceSpans.length; i += 1) {
// 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
if ($(checkBoxes[i]).attr("src") == "img/39.png") {
console.log($(checkBoxes[i]).attr("src"));
var price = parseFloat($(priceSpans[i]).text());
var count = parseInt($(countInputs[i]).val());
totalCount += count;
totalPrice += price * count;
}
}
$(".zoji span").html(totalPrice.toFixed(2));
}
function calcTotal2() {
var checkBoxes = $(".sh_cartround img");
var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");
var countInputs = $(".order_newsNum .order_newsnum");
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < priceSpans.length; i += 1) {
// 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
var price = parseFloat($(priceSpans[i]).text());
var count = parseInt($(countInputs[i]).val());
totalCount += count;
totalPrice += price * count;
}
$(".zoji span").html(totalPrice.toFixed(2));
}
$(function() {
$(".order_newsNum div").on("click", function(evt) {
if ($(this).text() == "-") {
... ... @@ -203,41 +238,6 @@
}
});
});
// 计算总计
function calcTotal() {
var checkBoxes = $(".sh_cartround img");
var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");
var countInputs = $(".order_newsNum .order_newsnum");
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < priceSpans.length; i += 1) {
// 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
if ($(checkBoxes[i]).attr("src") == "img/39.png") {
console.log($(checkBoxes[i]).attr("src"));
var price = parseFloat($(priceSpans[i]).text());
var count = parseInt($(countInputs[i]).val());
totalCount += count;
totalPrice += price * count;
}
}
$(".zoji span").html(totalPrice.toFixed(2));
}
function calcTotal2() {
var checkBoxes = $(".sh_cartround img");
var priceSpans = $(".order_newsTxt3 .de_topTxt1_1 span");
var countInputs = $(".order_newsNum .order_newsnum");
var totalCount = 0;
var totalPrice = 0;
for (var i = 0; i < priceSpans.length; i += 1) {
// 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
var price = parseFloat($(priceSpans[i]).text());
var count = parseInt($(countInputs[i]).val());
totalCount += count;
totalPrice += price * count;
}
$(".zoji span").html(totalPrice.toFixed(2));
}
});
</script>
</body>
... ...