function updateTotal(item, unitPrice)
{
var qta = item.value;
var total = "" + (Math.round(qta * unitPrice * 100) / 100);
total += (total.indexOf('\.')<0)?'.00':'0';
total = total.substr(0,total.indexOf('\.')+3).replace("\." ,",");
//Questa è la parte fissa che conosci nel tuo item passato alla funzione
var strQt = 'Qt';
//Questa è la parte fissa che sai avere il tuo elemento totale
var strTot = 'Totale';
//Posizione in cui inizia la parola Qta
var iPos = item.id.lastIndexOf(strQt);
//Recupero della parte variabile del nome
var strVar = item.id.substr(0, iPos)
//Composizione del nome dell'elemento totale da aggiornare
var strCurTotElem = strVar + strTot;
//Referenziazione all'elemento totale
var itemTotal = document.getElementById(strCurTotElem);
if(itemTotal != null)
itemTotal.value = total;
}
</script>
HTML
<TD class="testo7" bgcolor="#FEF2D6">
<input name="repCategorie:_ctl0:repArticoli:_ctl0:Px" type="text" value="9,7" maxlength="8" id="repCategorie__ctl0_repArticoli__ctl0_Px" disabled="disabled" class="TestoDataGridRight" style="width:30px;" />
</TD>
<TD class="testo7" bgcolor="#FEF2D6">
<input name="repCategorie:_ctl0:repArticoli:_ctl0:Qt" type="text" value="0" maxlength="8" id="repCategorie__ctl0_repArticoli__ctl0_Qt" class="TestoDataGridRight" onblur="javascript:updateTotal(this,9.6);" onkeyup="v=this.value; this.value=v.replace(/\D/gi,'') " style="width:30px;" />
</TD>
<TD class="testo7" bgcolor="#FEF2D6">
<input name="repCategorie:_ctl0:repArticoli:_ctl0:Totale" type="text" value="0" maxlength="8" id="repCategorie__ctl0_repArticoli__ctl0_Totale" class="TestoDataGridRight" style="width:60px;" />
</TD>
Grazie per l'aiuto