1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<script language="javascript">
function caculLgPrice(prix, nbre, numProd, ttProd) {
priceTTLg = prix*nbre;
total_numProd = 'total_'+numProd;
document.getElementById(total_numProd).value = priceTTLg;
//Calcul du total de la commande
var totalProd = 0;
var LaValeur;
//Calcul du total de la commande
var totalCommande = 0;
for(x=0;x<ttProd;x++) {
total_num = 'total_'+ x; //Récup le contenu de mon champ de formulaire
LaValeur = document.getElementById(total_num).value;
LaValeur = (isNaN(LaValeur))?"0":LaValeur;
totalProd = parseInt(LaValeur, 10);
totalCommande = totalCommande+totalProd;
}
document.getElementById("total").value = totalCommande;
}
</script> |