Ciao ragazzi e ragazze :P
ho una domanda da porre al forum, magari qualcuno più esperto può indicarmi la via giusta.
Ho realizzato un form che raccoglie determinati dati e realizza dei calcoli in base ad esempio:
quantità prodotto per fascia di prezzo di appartenenza.

Sono divise in diverse funzioni, ognuna dedicata ad uno specifico prodotto.

Ora dovrei, sommare i totali delle quantità e sommare i totali dei prezzi delle differenti fasce, per ottenere i loro relativi risultati in due campi a loro dedicati.

Non essendo una cima in java, mi viene un dubbio su come far raccogliere questi dati al form.

Per meglio capirci allego il java del form così magari vi illustro meglio il mio problema.




GRazie a tutti.
codice:
function calculateText1()
{
var op1=document.getElementById('tot1');
var op2=document.getElementById('tot2');
var result=document.getElementById('TOTAL1');
var SUBTOTAL1=document.getElementById('SUB_TOTAL');
document.getElementById('TOTAL1').value = (result.value);
document.getElementById('TOTAL2').value = document.getElementById('TOTAL1').value;

if(op1.value=="" || op1.value!=parseFloat(op1.value) || op1.value%30!=0) op1.value=0;
if(op2.value=="" || op2.value!=parseFloat(op2.value) || op2.value%30!=0) op2.value=0;

result.value=0;
result.value=parseInt(result.value);
result.value=parseInt(result.value)+parseInt(op1.value)+parseInt(op2.value);

if(result.value>0 && result.value<60) result.value=0.79;
if(result.value>30 && result.value<90) result.value=0.75;
if(result.value>60 && result.value<150) result.value=0.71;
if(result.value>120 && result.value<172800) result.value=0.71;

//TOTAL PACKAGE
document.getElementById('total_PACK1').value = parseInt(op1.value)+parseInt(op2.value);

if(document.getElementById('total_PACK1').value>0 && document.getElementById('total_PACK1').value<60) SUBTOTAL1.value=document.getElementById('total_PACK1').value*0.79;
if(document.getElementById('total_PACK1').value>30 && document.getElementById('total_PACK1').value<90) SUBTOTAL1.value=document.getElementById('total_PACK1').value*0.75;
if(document.getElementById('total_PACK1').value>60 && document.getElementById('total_PACK1').value<150) SUBTOTAL1.value=document.getElementById('total_PACK1').value*0.71;
if(document.getElementById('total_PACK1').value>120 && document.getElementById('total_PACK1').value<172800) SUBTOTAL1.value=document.getElementById('total_PACK1').value*0.71;

}

function calculateText2()
{
var op1=document.getElementById('tot3');
var op2=document.getElementById('tot4');
var result=document.getElementById('TOTAL3');
var SUBTOTAL2=document.getElementById('SUB_TOTAL2');
document.getElementById('TOTAL3').value = (result.value);
document.getElementById('TOTAL4').value = document.getElementById('TOTAL3').value;

if(op3.value=="" || op3.value!=parseFloat(op3.value) || op3.value%30!=0) op3.value=0;
if(op4.value=="" || op4.value!=parseFloat(op4.value) || op4.value%30!=0) op4.value=0;

result.value=0;
result.value=parseInt(result.value);
result.value=parseInt(result.value)+parseInt(op3.value)+parseInt(op4.value);

if(result.value>0 && result.value<60) result.value=0.99;
if(result.value>30 && result.value<90) result.value=0.85;
if(result.value>60 && result.value<150) result.value=0.61;
if(result.value>120 && result.value<172800) result.value=0.61;

//TOTAL PACKAGE
document.getElementById('total_PACK2').value = parseInt(op1.value)+parseInt(op2.value);

if(document.getElementById('total_PACK2').value>0 && document.getElementById('total_PACK2').value<60) SUBTOTAL1.value=document.getElementById('total_PACK2').value*0.99;
if(document.getElementById('total_PACK2').value>30 && document.getElementById('total_PACK2').value<90) SUBTOTAL1.value=document.getElementById('total_PACK2').value*0.85;
if(document.getElementById('total_PACK2').value>60 && document.getElementById('total_PACK2').value<150) SUBTOTAL1.value=document.getElementById('total_PACK2').value*0.61;
if(document.getElementById('total_PACK2').value>120 && document.getElementById('total_PACK2').value<172800) SUBTOTAL1.value=document.getElementById('total_PACK2').value*0.61;

}