|
@@ -57,6 +57,28 @@ for (let i = 1; i < 10; i++) {
|
|
|
document.body.appendChild(table)
|
|
|
|
|
|
// Calc
|
|
|
+// let calc = document.getElementById("calc");
|
|
|
+// let input1 = document.getElementById("input1");
|
|
|
+// let input2 = document.getElementById("input2");
|
|
|
+// calc.onclick = function () {
|
|
|
+// alert(`${(+input1.value) * (+input2.value)} km per week`);
|
|
|
+// }
|
|
|
+
|
|
|
+// Calc Live
|
|
|
+let calc = document.getElementById("calc");
|
|
|
+let input1 = document.getElementById("input1");
|
|
|
+let input2 = document.getElementById("input2");
|
|
|
+let result = document.getElementById("result");
|
|
|
+function calc1() {
|
|
|
+ result.innerText = (+input1.value) * (+input2.value)
|
|
|
+}
|
|
|
+input1.oninput = calc1
|
|
|
+input2.oninput = calc1
|
|
|
+calc.onclick = calc1
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|