1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- </head>
- <body>
- <!--
- <script>
- fetch('https://open.er-api.com/v6/latest/USD').then(res => res.json())
- .then(data => {
- let currencyFrom = document.createElement("select");
- currencyFrom.id = 'from'
- document.body.prepend(currencyFrom);
- let currencyTo = document.createElement("select");
- currencyFrom.id = 'to'
- document.body.prepend(currencyTo);
- const numberInput = document.getElementById('amount')
- numberInput.type = 'number'
- numberInput.value = '100'
- numberInput.oninput = () => {
- console.log('Чесло', numberInput.value)
- }
- for (const [key,rates] of Object.entries(data.rates)) {
- console.log(key,rates);
- currencyFrom.innerHTML += "<option>" + key + "</option>";
- currencyTo.innerHTML += "<option>" + key + "</option>";
- let course = document.getElementById('rate');
- const calcResult = () => {
- course.innerHTML = rates / 2;
- }
- calcResult()
- }
- }
- )
- </script> -->
- <!-- closure calc 2 -->
- <select id='from'> </select>
- <select id='to'> </select>
- <div>
- <p> Крос курс From <span id="rateFrom">___ </span> </p>
- </div>
- <div>
- <p> Крос курс To <span id="rateTo">___ </span> </p>
- </div>
- <input type='number' id='amount' />
- <div>
- <p > Результат <span id="result">___ </span> </p>
- </div>
- <!-- countries and cities -->
- <form action="">
- <select id="countrySelect" name=""></select>
- <select id="citySelect" name=""></select>
- </form>
- <script src="js.js"></script>
- </body>
- </html>
|