I did it concatenating the id, month and year:
function get_conts() {
var rows = document.getElementById('one').rows,
len = rows.length,
i,
cell_id = 1,
cell_month = 2,
cell_year = 3,
count = 0,
cell;
for (i = 1; i < len; i++) {
cellvalue_id = rows[i].cells[cell_id];
cellvalue_month = rows[i].cells[cell_month];
cellvalue_year = rows[i].cells[cell_year];
get_workers(cellvalue_id.innerHTML + "_" + cellvalue_month.innerHTML + "_" + cellvalue_year.innerHTML);
}
}
function get_workers(id_ent) {
var rows = document.getElementById('two').rows,
len = rows.length,
i,
cell_id = 1,
cell_month = 2,
cell_year = 3,
count = 0,
cell;
for (i = 1; i < len; i++) {
cellvalue_id = rows[i].cells[cell_id];
cellvalue_month = rows[i].cells[cell_month];
cellvalue_year = rows[i].cells[cell_year];
concatenated_text = cellvalue_id.innerHTML + "_" + cellvalue_month.innerHTML + "_" + cellvalue_year.innerHTML);
if (concatenated_text === id_ent.toString()) {
count++;
}
}
var total_workers = document.getElementById('total_' + id_ent).innerHTML;
document.getElementById('total_' + id_ent).innerHTML = (total_workers - count).toString();
console.log(total_workers + "-" + count);
}
get_conts();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…