0
这可能是一个简单的问题,但我该如何添加分钟以便他们变成小时,即如果您添加30分钟和30分钟30分钟,则会给出1小时30分钟的答案?我如何添加分钟,以便他们变成几小时?
到目前为止,我只是有几分钟总额:
function findTotalHours(){
var arr = document.getElementsByName('hours');
var tot=0;
for(var i=0;i<arr.length;i++){
if(parseInt(arr[i].value))
tot += parseInt(arr[i].value);
}
document.getElementById('totalHoursv').value = tot;
}
function findTotalMins(){
var arr = document.getElementsByName('minutes');
var tot=0;
for(var i=0;i<arr.length;i++){
if(parseInt(arr[i].value))
tot += parseInt(arr[i].value);
}
document.getElementById('totalMins').value = tot;
}
我创建了一个JS小提琴显示哪些工作不正常的表...即它给90分钟作为答案
https://jsfiddle.net/Vicky1984/kLurp45y/9/
不胜感激任何意见,我完全新的JavaScript
感谢
真棒太感谢你了,非常酷 – Vicky12345