Spaces:
Running
Running
<html> <head> <meta charset="UTF-8"> <title>Currency Converter</title> </head> <body> 💱 Currency Converter | |
by ☕ CofAI | |
<form> | |
<p></p> | |
<p></p> | |
<label for="amount">💰 Sum:</label> | |
<input type="number" id="amount" name="amount" min="0"> | |
<br><br> | |
<p></p> | |
<label for="from">🪙 From currency:</label> | |
<select id="from" name="from"> | |
<option value="RUB">₽ (Russian ruble)</option> | |
<option value="USD">$ (UWB dollar)</option> | |
<option value="EUR">€ (Euro)</option> | |
<option value="JPY">¥ (Japanese yen)</option> | |
</select> | |
<br><br> | |
<label for="to">💸 To currency:</label> | |
<select id="to" name="to"> | |
<option value="RUB">₽ (Russian ruble)</option> | |
<option value="USD">$ (UWB dollar)</option> | |
<option value="EUR">€ (Euro)</option> | |
<option value="JPY">¥ (Japanese yen)</option> | |
</select> | |
<br><br> | |
<p></p> | |
<input type="button" value="✅️ Convert" onclick="convertCurrency()"> | |
</form> | |
<p></p> | |
<h2>♾️ Result:</h2> | |
<div id="result"></div> | |
<script> | |
function convertCurrency() { | |
var amount = parseFloat(document.getElementById("amount").value); | |
var fromCurrency = document.getElementById("from").value; | |
var toCurrency = document.getElementById("to").value; | |
var result = 0; | |
// Курс валют можно добавить здесь или получать из внешнего источника | |
if (fromCurrency === "RUB" && toCurrency === "USD") { | |
result = amount / 90,40; // Примерный курс | |
} else if (fromCurrency === "RUB" && toCurrency === "EUR") { | |
result = amount / 100,58; // Примерный курс | |
} else if (fromCurrency === "RUB" && toCurrency === "JPY") { | |
result = amount / 0,64; // Примерный курс | |
} else if (fromCurrency === "USD" && toCurrency === "RUB") { | |
result = amount * 90,40; // Примерный курс | |
} else if (fromCurrency === "USD" && toCurrency === "EUR") { | |
result = amount * 0,90; // Примерный курс | |
} else if (fromCurrency === "USD" && toCurrency === "JPY") { | |
result = amount * 140,45; // Примерный курс | |
} else if (fromCurrency === "EUR" && toCurrency === "RUB") { | |
result = amount * 100,57; // Примерный курс | |
} else if (fromCurrency === "EUR" && toCurrency === "USD") { | |
result = amount * 1,11; // Примерный курс | |
} else if (fromCurrency === "EUR" && toCurrency === "JPY") { | |
result = amount * 156,26; // Примерный курс | |
} else if (fromCurrency === "JPY" && toCurrency === "RUB") { | |
result = amount * 0,64; // Примерный курс | |
} else if (fromCurrency === "JPY" && toCurrency === "USD") { | |
result = amount * 0,0071; // Примерный курс | |
} else if (fromCurrency === "JPY" && toCurrency === "EUR") { | |
result = amount * 0,0064; // Примерный курс | |
} else { | |
result = amount; | |
} | |
document.getElementById("result").innerHTML = result.toFixed(2); | |
} | |
</script> | |
</body> </html> |