问题找出来了,不要用for (var i in lis) { ...
这样就足够:
//计算小时数
function countHours() {
var hn = document.getElementById('hournum');
var lis = document.getElementById('sheet').getElementsByTagName('li');
var hc = 0;
for (var i = 0; i < lis.length; i++) {
if ('hours' == lis[i].className) {
hc += parseInt(lis[i].innerHTML);
}
}
hn.innerHTML = hc;
}
--
FROM 210.51.173.*