Kaynağa Gözat

j,f pflfybz gj lp2

GennadyBerg 2 yıl önce
ebeveyn
işleme
05d43aa117
2 değiştirilmiş dosya ile 70 ekleme ve 0 silme
  1. 35 0
      js/02/index.html
  2. 35 0
      js/02/indexmy.html

+ 35 - 0
js/02/index.html

@@ -0,0 +1,35 @@
+/*Задание для синего пояса выполнено с участием черного)))  в след файле - задание выполнено мной..*/
+
+
+<head>
+</head>
+<body>
+  <div>
+    <input id="login" type="text" size="20" placeholder="login" />
+    <input id="pass" type="text" size="20" placeholder="password" />
+    <button onclick="checkCredentialsBtnClick()" >
+      Check Credentials
+    </button>
+    <br><br>
+    <div id="result" style="display: inline-block;color:white;"></div>
+    <script>
+      var credentials = {
+        login: 'admin',
+        password: 'qwerty',
+      };
+      function checkCredentialsBtnClick(){
+        login = document.getElementById('login').value;
+        pass = document.getElementById('pass').value;
+        result = document.getElementById('result');
+        if (credentials['login'] == login && credentials['password'] == pass){
+          result.style.backgroundColor = 'green';
+          result.innerHTML = "OK!"
+        }
+        else{
+          result.style.backgroundColor = 'red';
+          result.innerHTML = "Wrong credentials!"
+        }
+      }
+    </script>
+  </div>
+</body>

+ 35 - 0
js/02/indexmy.html

@@ -0,0 +1,35 @@
+<head>
+</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="debetCalculation()"> //нажимаем на кнопку для расчета//
+            DEBET Calc
+        </button>
+        <br><br>
+        <div id="calc" style="display: inline-block;color:greenyellow;"></div>
+        <script>
+            function debetCalculation() {
+                testimony1 = parseFloat(document.getElementById('testimony1').value);
+                testimony2 = parseFloat(document.getElementById('testimony2').value);
+                tarif = parseFloat(document.getElementById('tarif').value);
+                startbalance = parseFloat(document.getElementById('startbalance').value);
+                calc = document.getElementById('calc');
+                result = startbalance - (testimony2 - testimony1) * tarif;
+                calc.innerHTML = result.toString();
+                if (result > 0) {
+                    calc.style.backgroundColor = 'green';
+                    calc.innerHTML="Total Amount: "+calc.innerHTML;
+                }
+                else {
+                    calc.style.backgroundColor = 'red';
+                    /*calc.innerHTML = "DEBET!"*/
+                }
+            }
+        </script>
+    </div>
+</body>