{"id":73,"date":"2024-03-25T10:47:57","date_gmt":"2024-03-25T10:47:57","guid":{"rendered":"https:\/\/calcuconvertonline.com\/?page_id=73"},"modified":"2024-03-25T10:47:58","modified_gmt":"2024-03-25T10:47:58","slug":"temperate-unit-converter","status":"publish","type":"page","link":"https:\/\/calcuconvertonline.com\/index.php\/temperate-unit-converter\/","title":{"rendered":"Temperate Unit 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>Temperature Converter<\/title>\n    <style>\n        body {\n            background-color: #3498db;\n            color: #fff;\n            font-family: Arial, sans-serif;\n            text-align: center;\n            margin: 0;\n            padding: 0;\n        }\n\n        #converter {\n            max-width: 400px;\n            margin: 50px auto;\n            background-color: #2980b9;\n            padding: 20px;\n            border-radius: 10px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);\n        }\n\n        h1 {\n            color: #fff;\n        }\n\n        input {\n            width: 80%;\n            padding: 8px;\n            margin: 10px 0;\n            box-sizing: border-box;\n        }\n\n        select {\n            width: 85%;\n            padding: 8px;\n            margin: 10px 0;\n            box-sizing: border-box;\n        }\n\n        button {\n            background-color: #2ecc71;\n            color: #fff;\n            padding: 10px 20px;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n        }\n\n        button:hover {\n            background-color: #27ae60;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div id=\"converter\">\n        <h1>Temperature Converter<\/h1>\n        <input type=\"number\" id=\"inputValue\" placeholder=\"Enter temperature\" \/>\n        <select id=\"fromUnit\">\n            <option value=\"celsius\">Celsius<\/option>\n            <option value=\"fahrenheit\">Fahrenheit<\/option>\n            <option value=\"kelvin\">Kelvin<\/option>\n            <option value=\"rankine\">Rankine<\/option>\n        <\/select>\n        <br \/>\n        <select id=\"toUnit\">\n            <option value=\"celsius\">Celsius<\/option>\n            <option value=\"fahrenheit\">Fahrenheit<\/option>\n            <option value=\"kelvin\">Kelvin<\/option>\n            <option value=\"rankine\">Rankine<\/option>\n        <\/select>\n        <br \/>\n        <button onclick=\"convertTemperature()\">Convert<\/button>\n        <p id=\"result\"><\/p>\n    <\/div>\n\n    <script>\n        function convertTemperature() {\n            const inputValue = parseFloat(document.getElementById('inputValue').value);\n            const fromUnit = document.getElementById('fromUnit').value;\n            const toUnit = document.getElementById('toUnit').value;\n\n            let result;\n\n            switch (fromUnit) {\n                case 'celsius':\n                    result = convertFromCelsius(inputValue, toUnit);\n                    break;\n                case 'fahrenheit':\n                    result = convertFromFahrenheit(inputValue, toUnit);\n                    break;\n                case 'kelvin':\n                    result = convertFromKelvin(inputValue, toUnit);\n                    break;\n                case 'rankine':\n                    result = convertFromRankine(inputValue, toUnit);\n                    break;\n                default:\n                    result = 'Invalid unit';\n            }\n\n            document.getElementById('result').innerText = `Converted temperature: ${result.toFixed(2)} ${toUnit}`;\n        }\n\n        function convertFromCelsius(value, toUnit) {\n            switch (toUnit) {\n                case 'celsius':\n                    return value;\n                case 'fahrenheit':\n                    return (value * 9\/5) + 32;\n                case 'kelvin':\n                    return value + 273.15;\n                case 'rankine':\n                    return (value + 273.15) * 9\/5;\n                default:\n                    return 'Invalid unit';\n            }\n        }\n\n        function convertFromFahrenheit(value, toUnit) {\n            switch (toUnit) {\n                case 'celsius':\n                    return (value - 32) * 5\/9;\n                case 'fahrenheit':\n                    return value;\n                case 'kelvin':\n                    return (value - 32) * 5\/9 + 273.15;\n                case 'rankine':\n                    return value + 459.67;\n                default:\n                    return 'Invalid unit';\n            }\n        }\n\n        function convertFromKelvin(value, toUnit) {\n            switch (toUnit) {\n                case 'celsius':\n                    return value - 273.15;\n                case 'fahrenheit':\n                    return (value - 273.15) * 9\/5 + 32;\n                case 'kelvin':\n                    return value;\n                case 'rankine':\n                    return value * 9\/5;\n                default:\n                    return 'Invalid unit';\n            }\n        }\n\n        function convertFromRankine(value, toUnit) {\n            switch (toUnit) {\n                case 'celsius':\n                    return (value - 491.67) * 5\/9;\n                case 'fahrenheit':\n                    return value - 459.67;\n                case 'kelvin':\n                    return value * 5\/9;\n                case 'rankine':\n                    return value;\n                default:\n                    return 'Invalid unit';\n            }\n        }\n    <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Temperature Converter Temperature Converter CelsiusFahrenheitKelvinRankine CelsiusFahrenheitKelvinRankine Convert<\/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-73","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages\/73","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=73"}],"version-history":[{"count":1,"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages\/73\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/pages\/73\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/calcuconvertonline.com\/index.php\/wp-json\/wp\/v2\/media?parent=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}