发布网友 发布时间:2023-03-24 06:37
共1个回答
热心网友 时间:2023-10-16 11:59
(function(document){ var tableEl = document.getElementById("tableId"), trs = tableEl.getElementsByTagName("tr"), fTds = trs[0].getElementsByTagName("td"), index = 0, isAllZero = true; for (var i = fTds.length; i--;){ if (fTds[i].innerText === "scshl"){ index = i; break; } } for (var i = 1, j = trs.length; i < j; i++){ var tdEl = trs[i].getElementsByTagName("td")[index]; if (+tdEl.innerText !== 0){ isAllZero = false; break; } } if (isAllZero){ alert("全部为零"); } })(document)