Spaces:
Running
Running
TenPoisk commited on
Commit ·
098ffc8
1
Parent(s): 28b7b14
Update index.html
Browse files- index.html +74 -19
index.html
CHANGED
|
@@ -1,19 +1,74 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Currency Converter</title> </head> <body> 💱 Currency Converter
|
| 2 |
+
by ☕ CofAI
|
| 3 |
+
<form>
|
| 4 |
+
<p></p>
|
| 5 |
+
<p></p>
|
| 6 |
+
<label for="amount">💰 Sum:</label>
|
| 7 |
+
<input type="number" id="amount" name="amount" min="0">
|
| 8 |
+
<br><br>
|
| 9 |
+
<p></p>
|
| 10 |
+
<label for="from">🪙 From currency:</label>
|
| 11 |
+
<select id="from" name="from">
|
| 12 |
+
<option value="RUB">₽ (Russian ruble)</option>
|
| 13 |
+
<option value="USD">$ (UWB dollar)</option>
|
| 14 |
+
<option value="EUR">€ (Euro)</option>
|
| 15 |
+
<option value="JPY">¥ (Japanese yen)</option>
|
| 16 |
+
</select>
|
| 17 |
+
<br><br>
|
| 18 |
+
|
| 19 |
+
<label for="to">💸 To currency:</label>
|
| 20 |
+
<select id="to" name="to">
|
| 21 |
+
<option value="RUB">₽ (Russian ruble)</option>
|
| 22 |
+
<option value="USD">$ (UWB dollar)</option>
|
| 23 |
+
<option value="EUR">€ (Euro)</option>
|
| 24 |
+
<option value="JPY">¥ (Japanese yen)</option>
|
| 25 |
+
</select>
|
| 26 |
+
<br><br>
|
| 27 |
+
<p></p>
|
| 28 |
+
<input type="button" value="✅️ Convert" onclick="convertCurrency()">
|
| 29 |
+
</form>
|
| 30 |
+
<p></p>
|
| 31 |
+
<h2>♾️ Result:</h2>
|
| 32 |
+
<div id="result"></div>
|
| 33 |
+
|
| 34 |
+
<script>
|
| 35 |
+
function convertCurrency() {
|
| 36 |
+
var amount = parseFloat(document.getElementById("amount").value);
|
| 37 |
+
var fromCurrency = document.getElementById("from").value;
|
| 38 |
+
var toCurrency = document.getElementById("to").value;
|
| 39 |
+
var result = 0;
|
| 40 |
+
|
| 41 |
+
// Курс валют можно добавить здесь или получать из внешнего источника
|
| 42 |
+
|
| 43 |
+
if (fromCurrency === "RUB" && toCurrency === "USD") {
|
| 44 |
+
result = amount / 90,40; // Примерный курс
|
| 45 |
+
} else if (fromCurrency === "RUB" && toCurrency === "EUR") {
|
| 46 |
+
result = amount / 100,58; // Примерный курс
|
| 47 |
+
} else if (fromCurrency === "RUB" && toCurrency === "JPY") {
|
| 48 |
+
result = amount / 0,64; // Примерный курс
|
| 49 |
+
} else if (fromCurrency === "USD" && toCurrency === "RUB") {
|
| 50 |
+
result = amount * 90,40; // Примерный курс
|
| 51 |
+
} else if (fromCurrency === "USD" && toCurrency === "EUR") {
|
| 52 |
+
result = amount * 0,90; // Примерный курс
|
| 53 |
+
} else if (fromCurrency === "USD" && toCurrency === "JPY") {
|
| 54 |
+
result = amount * 140,45; // Примерный курс
|
| 55 |
+
} else if (fromCurrency === "EUR" && toCurrency === "RUB") {
|
| 56 |
+
result = amount * 100,57; // Примерный курс
|
| 57 |
+
} else if (fromCurrency === "EUR" && toCurrency === "USD") {
|
| 58 |
+
result = amount * 1,11; // Примерный курс
|
| 59 |
+
} else if (fromCurrency === "EUR" && toCurrency === "JPY") {
|
| 60 |
+
result = amount * 156,26; // Примерный курс
|
| 61 |
+
} else if (fromCurrency === "JPY" && toCurrency === "RUB") {
|
| 62 |
+
result = amount * 0,64; // Примерный курс
|
| 63 |
+
} else if (fromCurrency === "JPY" && toCurrency === "USD") {
|
| 64 |
+
result = amount * 0,0071; // Примерный курс
|
| 65 |
+
} else if (fromCurrency === "JPY" && toCurrency === "EUR") {
|
| 66 |
+
result = amount * 0,0064; // Примерный курс
|
| 67 |
+
} else {
|
| 68 |
+
result = amount;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
document.getElementById("result").innerHTML = result.toFixed(2);
|
| 72 |
+
}
|
| 73 |
+
</script>
|
| 74 |
+
</body> </html>
|