aboutsummaryrefslogtreecommitdiff
path: root/scripts/_stats-script.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/_stats-script.js')
-rw-r--r--scripts/_stats-script.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/_stats-script.js b/scripts/_stats-script.js
new file mode 100644
index 0000000..43b795e
--- /dev/null
+++ b/scripts/_stats-script.js
@@ -0,0 +1,9 @@
+updateSubTotal(); // Initial call
+
+function updateSubTotal() {
+ var table = document.getElementById("myTable");
+ let subTotal = Array.from(table.rows).slice(1).reduce((total, row) => {
+ return total + parseFloat(row.cells[1].innerHTML);
+ }, 0);
+ document.getElementById("val").innerHTML = "SubTotal =" + (subTotal.toFixed(2) / 742);
+}