Andrii Kozhyn 2 år sedan
förälder
incheckning
7f627880d5
3 ändrade filer med 55 tillägg och 0 borttagningar
  1. 26 0
      index.html
  2. 25 0
      script1.js
  3. 4 0
      style.css

+ 26 - 0
index.html

@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <link rel="stylesheet" href="style.css">
+</head>
+<body>
+  
+     <h3>Обменка $ к UAH</h3>
+     <div class="menu">
+         Отдаете $: <input class="inp" type="number" placeholder="Количество Долларов" onchange="convert(this.value)">
+
+         <button id="cash"> w </button>
+         <p class="get">
+         Получаете:  <span id="out" ></span> uah
+            
+         </p>
+     </div>
+    
+
+    <script src="script1.js"></script>
+</body>
+</html>

+ 25 - 0
script1.js

@@ -0,0 +1,25 @@
+let cash = document.getElementById('cash');
+let out = document.getElementById('out');
+let cash2 = document.getElementById('cash');
+
+function convert (cash) {
+    out.innerHTML = cash * 26.3;
+}
+
+
+
+
+// ________________________________
+
+// Вариант второй без привязки к index.html(через prompt и alert)
+
+
+// function convert () {
+//     let amount = prompt("Введите сумму в долларах. ","");
+//     let courseParameter = prompt("Введите курс доллара")
+//     let summ = courseParameter * amount;
+//     alert(summ.toFixed(2) + " Uah");
+    
+//     }
+    
+//     convert()

+ 4 - 0
style.css

@@ -0,0 +1,4 @@
+
+.inp {
+margin-left: 5px;
+}