GennadyBerg 2 éve
szülő
commit
6a7d578f20

+ 1 - 1
js/08/hw08_13_!Table.html

@@ -49,7 +49,7 @@
         const copySorter = (arr, sortName, asc = true) => {
             //const copy = {...person}
             sortedArr = sort(
-                arr.map(obj => { return { ...obj }; }),
+                [...arr],
                 sortName,
                 asc);
 

+ 42 - 0
js/08/hw08_15_!Calc Func.html

@@ -0,0 +1,42 @@
+// отправка с уведомлением//
+
+<head>
+    <h1>CalcFunc</h1>
+</head>
+
+<body>
+    <div>
+        <input id="testimony1" type="number" size="12" placeholder="data1" />//вносим показания старта периода//
+        <input id="testimony2" type="number" size="12" placeholder="data2" />// вносим показания учета на конец
+        периода//
+        <input id="tarif" type="number" size="12" placeholder="tarif" /> // вводим тариф на услугу//
+        <input id="startbalance" type="number" size="12" placeholder="startbalance" />// вводим баланс на старте
+        периода//
+        <button onclick="debetCalculationOnClick()"> //нажимаем на кнопку для расчета//
+            DEBET Calc
+        </button>
+        <br><br>
+        <div id="calc" style="display: inline-block;color:greenyellow;"></div>
+        <script>
+            const debetCalculation = (testimony1, testimony2, tarif, startbalance) =>
+                result = startbalance - (testimony2 - testimony1) * tarif;
+            const debetCalculationOnClick = () => {
+                testimony1Val = parseFloat(testimony1.value);
+                testimony2Val = parseFloat(testimony2.value);
+                tarifVal = parseFloat(tarif.value);
+                startbalanceVal = parseFloat(startbalance.value);
+                result = debetCalculation(testimony1Val, testimony2Val, tarifVal, startbalanceVal);
+                calc = document.getElementById('calc');
+                calc.innerHTML = result.toString();
+                if (result > 0) {
+                    calc.style.backgroundColor = 'green';
+                    calc.innerHTML = "Total Amount: " + calc.innerHTML;
+                }
+                else {
+                    calc.style.backgroundColor = 'red';
+                }
+            }
+            //testimony1.oninput=debetCalculationOnClick;
+        </script>
+    </div>
+</body>

+ 0 - 10
js/08/hw08_15_Calc Func.html

@@ -1,10 +0,0 @@
-<header>
-    <h1>CalcFunc</h1>
-</header>
-
-<body>
-    <script>
-        
-    </script>
-
-</body>

+ 50 - 0
js/08/hw08_16_!CalcLive.html

@@ -0,0 +1,50 @@
+// отправка с уведомлением//
+
+<head>
+    <h1>CalcFunc</h1>
+</head>
+
+<body>
+    <div>
+        <input id="testimony1" type="number" size="12" placeholder="0" />//вносим показания старта периода//<br>
+        <input id="testimony2" type="number" size="12" placeholder="0" />//вносим показания учета на конец
+        периода//<br>
+
+        <input id="tarif" type="number" size="12" placeholder="0" />//вводим тариф на услугу//<br>
+        <input id="startbalance" type="number" size="12" placeholder="0" />//вводим баланс на старте
+        периода//<br>
+
+        <!--<button onclick="debetCalculationOnClick()"> //нажимаем на кнопку для расчета//
+            DEBET Calc
+        </button>-->
+        <br><br>
+        <div id="calc" style="display: inline-block;color:greenyellow;"></div>
+        <script>
+            const debetCalculation = (testimony1, testimony2, tarif, startbalance) =>
+                result = startbalance - (testimony2 - testimony1) * tarif;
+            const debetCalculationOnClick = () => {
+                testimony1Val = parseFloat(testimony1.value);
+                testimony2Val = parseFloat(testimony2.value);
+                tarifVal = parseFloat(tarif.value);
+                startbalanceVal = parseFloat(startbalance.value);
+                result = debetCalculation(testimony1Val, testimony2Val, tarifVal, startbalanceVal);
+                calc = document.getElementById('calc');
+                calc.innerHTML = result.toString();
+                if (result > 0) {
+                    calc.style.backgroundColor = 'green';
+                    calc.innerHTML = "Total Amount: " + calc.innerHTML;
+                }
+                else if (isNaN(result))
+                    calc.innerHTML = "";
+                else {
+                    calc.style.backgroundColor = 'red';
+                }
+            }
+
+            testimony1.oninput = debetCalculationOnClick;
+            testimony2.oninput = debetCalculationOnClick;
+            tarif.oninput = debetCalculationOnClick;
+            startbalance.oninput = debetCalculationOnClick;
+        </script>
+    </div>
+</body>

+ 0 - 10
js/08/hw08_16_CalcLive.html

@@ -1,10 +0,0 @@
-<header>
-    <h1>Literals</h1>
-</header>
-
-<body>
-    <script>
-        
-    </script>
-
-</body>