index.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. </head>
  7. <body>
  8. <!--
  9. <script>
  10. fetch('https://open.er-api.com/v6/latest/USD').then(res => res.json())
  11. .then(data => {
  12. let currencyFrom = document.createElement("select");
  13. currencyFrom.id = 'from'
  14. document.body.prepend(currencyFrom);
  15. let currencyTo = document.createElement("select");
  16. currencyFrom.id = 'to'
  17. document.body.prepend(currencyTo);
  18. const numberInput = document.getElementById('amount')
  19. numberInput.type = 'number'
  20. numberInput.value = '100'
  21. numberInput.oninput = () => {
  22. console.log('Чесло', numberInput.value)
  23. }
  24. for (const [key,rates] of Object.entries(data.rates)) {
  25. console.log(key,rates);
  26. currencyFrom.innerHTML += "<option>" + key + "</option>";
  27. currencyTo.innerHTML += "<option>" + key + "</option>";
  28. let course = document.getElementById('rate');
  29. const calcResult = () => {
  30. course.innerHTML = rates / 2;
  31. }
  32. calcResult()
  33. }
  34. }
  35. )
  36. </script> -->
  37. <!-- closure calc 2 -->
  38. <select id='from'> </select>
  39. <select id='to'> </select>
  40. <div>
  41. <p> Крос курс From <span id="rateFrom">___ </span> </p>
  42. </div>
  43. <div>
  44. <p> Крос курс To <span id="rateTo">___ </span> </p>
  45. </div>
  46. <input type='number' id='amount' />
  47. <div>
  48. <p > Результат <span id="result">___ </span> </p>
  49. </div>
  50. <!-- countries and cities -->
  51. <form action="">
  52. <select id="countrySelect" name=""></select>
  53. <select id="citySelect" name=""></select>
  54. </form>
  55. <script src="js.js"></script>
  56. </body>
  57. </html>