123456789101112131415161718 |
- <head>Currency drop down</head>
- <body>
- <script>
- fetch(`https://open.er-api.com/v6/latest/USD`)
- .then(response => response.json())
- .then(data => {
- const currencies = Object.keys(data.rates);
- let str = "<select>";
- for (let currency of currencies) {
- str += `<option>${currency}</option>`;
- }
- str += "</select>";
- document.write(str);
- });
- </script>
- </body>
|