这里是我的代码表计算行:如何通过JavaScript的
<html>
<body>
<table id="my Table">
<tbody>
<tr>
而($行= mysqli_fetch_assoc($结果))
<td>
<?php echo $row['ItemQTY']; ?>
</td>
</tr>
<tr class="total Column">
<td class="tota Column">Total:</td>
</tr>
</tbody>
</table>
</body>
</html>
我想要在最后一行的ItemQTY
这个Java表和在表中搜索
function myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
但这个脚本不计算总数量 如何可以使用此代码添加计算行
发布您的代码,到目前为止您所做的一切! –
计算总的通过函数,然后用这个值动态添加一个新的tr –
你能解释一下吗? – Abdulrhman