ecco qui
codice:
<head>
<script type="text/javascript">
// <![CDATA[
function sumTime() {
var tm1 = parseInt((document.getElementById('t1').value*100), 10) / 100;
var tm2 = parseInt((document.getElementById('t2').value*100), 10) / 100;
// trasformo in minuti
min1 = ((tm1 - Math.floor(tm1)) * 100) + (parseInt(Math.floor(tm1), 10) * 60);
min2 = ((tm2 - Math.floor(tm2)) * 100) + (parseInt(Math.floor(tm2), 10) * 60);
var minTot = min1 + min2;
var tm3 = Math.floor(minTot / 60) + ((minTot % 60) / 100);
document.getElementById('totale').value = tm3;
}
// ]]>
</script>
</head>
<body>
<form>
<input type="text" id="t1" value="2.58" />
<input type="text" id="t2" value="3.40" />
<input type="button" onclick="sumTime()" />
<input type="text" id="totale" />
</form>
</body>
Ciao