grazie br1
funziona perfettamente, anche con i numeri negativi
ecco il codice finale
codice:
//valore 1
var transizione_=document.getElementById('transizione').value;
//valore 2
var tot='<?php echo number_format (($calcolo_dafatturare), 2, ',','.'); ?>';
//calcolo totale
var totcontrans=parseFloat(transizione_.replace(",",".")) + parseFloat(tot.replace(",","."));
// moltiplica per cento arrotondando e trasforma in stringa
str = "" + Math.round(totcontrans * 100);
// aggiungi la virgola al punto giusto
str = str.substr(0,str.length-2)+","+str.substr(str.length-2);
//stampo alert
alert('Totale aggiornato a: '+str)
//scrivo il totale
document.form.totale.value=str;