{"id":20,"date":"2024-03-25T09:58:20","date_gmt":"2024-03-25T09:58:20","guid":{"rendered":"https:\/\/calcuconvertonline.com\/?page_id=20"},"modified":"2024-03-27T11:05:20","modified_gmt":"2024-03-27T11:05:20","slug":"currency-converter","status":"publish","type":"page","link":"https:\/\/calcuconvertonline.com\/index.php\/currency-converter\/","title":{"rendered":"Currency Converter"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Currency Converter<\/title>\n  <style>\n    \/* Styles *\/\n    body {\n      font-family: Arial, sans-serif;\n      margin: 0;\n      padding: 0;\n      \n      justify-content: center;\n      align-items: center;\n      height: 100vh;\n      background-color: #f0f5f9;\n    }\n\n    .converter {\n      background-color: #e0e9f0;\n      padding: 30px;\n      border-radius: 8px;\n      box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);\n      text-align: center;\n    }\n\n    h1 {\n      margin-bottom: 20px;\n      color: #3498db;\n    }\n\n    .input-container {\n      margin-bottom: 20px;\n    }\n\n    label {\n      display: block;\n      margin-bottom: 10px;\n      color: #2980b9;\n      font-weight: bold;\n    }\n\n    input[type=\"number\"],\n    input[type=\"text\"],\n    select {\n      padding: 10px;\n      border-radius: 5px;\n      border: 1px solid #ccc;\n      width: 180px;\n    }\n\n    button {\n      padding: 10px 30px;\n      background-color: #3498db;\n      color: #fff;\n      border: none;\n      border-radius: 5px;\n      cursor: pointer;\n      transition: background-color 0.3s ease;\n    }\n\n    button:hover {\n      background-color: #2980b9;\n    }\n\n    .description {\n      font-style: italic;\n      color: #555;\n      margin-bottom: 20px;\n    }\n  <\/style>\n<\/head>\n<body>\n  <div class=\"converter\">\n    <h1>Currency Converter<\/h1>\n    <p class=\"description\">This Currency Converter tool allows users to convert currency values based on the latest exchange rates retrieved from the exchangerate-api.com API.<\/p>\n    <div class=\"input-container\">\n      <label for=\"from\">From:<\/label>\n      <select id=\"from\"><\/select>\n      <input type=\"number\" id=\"amount\" placeholder=\"Enter amount\">\n    <\/div>\n    <div class=\"input-container\">\n      <label for=\"to\">To:<\/label>\n      <select id=\"to\"><\/select>\n      <input type=\"text\" id=\"converted-amount\" disabled>\n    <\/div>\n    <button id=\"convert-btn\">Convert<\/button>\n   \n  <script>\n    \/\/ JavaScript code for currency conversion\n    document.addEventListener('DOMContentLoaded', function () {\n      const fromCurrency = document.getElementById('from');\n      const toCurrency = document.getElementById('to');\n      const amount = document.getElementById('amount');\n      const convertedAmount = document.getElementById('converted-amount');\n      const convertBtn = document.getElementById('convert-btn');\n\n      \/\/ Fetch currency data\n      fetch('https:\/\/api.exchangerate-api.com\/v4\/latest\/USD')\n        .then(response => response.json())\n        .then(data => {\n          const currencies = Object.keys(data.rates);\n\n          currencies.forEach(currency => {\n            const option1 = document.createElement('option');\n            option1.textContent = currency;\n            option1.value = currency;\n            fromCurrency.appendChild(option1);\n\n            const option2 = document.createElement('option');\n            option2.textContent = currency;\n            option2.value = currency;\n            toCurrency.appendChild(option2);\n          });\n\n          convertBtn.addEventListener('click', () => {\n            const from = fromCurrency.value;\n            const to = toCurrency.value;\n            const exchangeRate = data.rates[to] \/ data.rates[from];\n            const result = (amount.value * exchangeRate).toFixed(2);\n            convertedAmount.value = result;\n          });\n        })\n        .catch(error => console.log('Error fetching currency data:', error));\n    });\n  <\/script>\n<\/body>\n<\/html>\n\n\n\n<h2 class=\"wp-block-heading\">How to Use Currency Converter<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Select the source currency from the \u201cFrom\u201d dropdown menu.<\/li>\n\n\n\n<li>Enter the amount you want to convert in the \u201cEnter amount\u201d field.<\/li>\n\n\n\n<li>Select the target currency from the \u201cTo\u201d dropdown menu.<\/li>\n\n\n\n<li>Click the \u201cConvert\u201d button.<\/li>\n\n\n\n<li>View the converted amount in the \u201cTo\u201d field.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Currency Converter Currency Converter This Currency Converter tool allows users to convert currency values based on the latest exchange rates retrieved from the exchangerate-api.com API. From: To: Convert How to Use Currency Converter<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-20","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":3,"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages\/20\/revisions"}],"predecessor-version":[{"id":164,"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages\/20\/revisions\/164"}],"wp:attachment":[{"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/media?parent=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}