hello daniweb friends
i need help in my below calculation script all go right but just in the filed shippingtotal it display NaN
i don't know why
i tried the comment in line 27 and delete line 6 but still same. HELP PLEASE
<script type="text/javascript">
function calculatePtotal() {
var totalofptotal = 0;
var wholeqtty = 0;
var totalofweight = 0;
var shippingtotal = 0;
$("tr.calc", "#myTable", "#panierform").each(function (i, row) {
$row = $(row);
var value = parseFloat($('.prix', $row).val());
var quantity = parseFloat($(".quantity", $row).val());
var poid = parseInt($(".poid", $row).val());
var shipping = parseFloat($(".shipping", $row).val());
var ptotal = (value * quantity).toFixed(2);
var weight = (poid * quantity) .toFixed(0);
$(".quantiy", $row).val(quantity);
$(".ptotal", $row).val(ptotal);
$(".weight", $row).val(weight);
totalofptotal += parseFloat(ptotal);
wholeqtty += parseInt(quantity);
totalofweight += parseInt(weight);
});
$("#wholeqtty") .val(wholeqtty.toFixed(0));
$("#totalofweight") .val(totalofweight.toFixed(0));
$("#totalofptotal").val(totalofptotal.toFixed(2));
}
{
shippingtotal =(shipping * totalofweight).toFixed(2) ; /* i tried to put he var shippingtotal =(shipping * totalofweight).toFixed(2) ; and delete line */
}
{
$("#shippingtotal").val(shippingtotal);
}
calculatePtotal();
$(".quantity, .shipping").change(function () {
calculatePtotal();
});
</script>