{"id":768,"date":"2024-05-09T09:30:43","date_gmt":"2024-05-09T09:30:43","guid":{"rendered":"https:\/\/worldseotool.com\/?page_id=768"},"modified":"2024-05-09T09:30:43","modified_gmt":"2024-05-09T09:30:43","slug":"body-fat-calculator","status":"publish","type":"page","link":"https:\/\/shoptips24.com\/tools\/body-fat-calculator\/","title":{"rendered":"Body Fat Calculator"},"content":{"rendered":"\n\n    <style>\n        .calculator {\n            max-width: 400px;\n            margin: 50px auto;\n            padding: 20px;\n            border: 1px solid #ccc;\n            border-radius: 5px;\n        }\n        \n        .form-group {\n            margin-bottom: 10px;\n        }\n        \n        button {\n            padding: 10px 20px;\n            background-color: #007bff;\n            color: #fff;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n        }\n        \n        button:hover {\n            background-color: #0056b3;\n        }\n        \n        #result {\n            margin-top: 20px;\n            font-weight: bold;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"calculator\">\n        <h2>Body Fat Calculator<\/h2>\n        <div class=\"form-group\">\n            <label for=\"gender\">Gender<\/label>\n            <select id=\"gender\" name=\"gender\" required>\n                <option value=\"male\">Male<\/option>\n                <option value=\"female\">Female<\/option>\n            <\/select>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"height\">Height (cm)<\/label>\n            <input type=\"number\" id=\"height\" name=\"height\" min=\"1\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"waist\">Waist Circumference (cm)<\/label>\n            <input type=\"number\" id=\"waist\" name=\"waist\" min=\"1\" required>\n        <\/div>\n        <div class=\"form-group\" id=\"neckGroup\">\n            <label for=\"neck\">Neck Circumference (cm)<\/label>\n            <input type=\"number\" id=\"neck\" name=\"neck\" min=\"1\" required>\n        <\/div>\n        <div class=\"form-group\" id=\"hipGroup\" style=\"display:none;\">\n            <label for=\"hip\">Hip Circumference (cm) <span>(For Women Only)<\/span><\/label>\n            <input type=\"number\" id=\"hip\" name=\"hip\" min=\"1\" required>\n        <\/div>\n        <button type=\"button\" onclick=\"calculateBodyFat()\">Calculate<\/button>\n        <div id=\"result\"><\/div>\n    <\/div>\n\n    <script>\n        function calculateBodyFat() {\n            var gender = document.getElementById('gender').value;\n            var height = parseFloat(document.getElementById('height').value);\n            var waist = parseFloat(document.getElementById('waist').value);\n            var neck = parseFloat(document.getElementById('neck').value);\n            var hip = parseFloat(document.getElementById('hip').value);\n\n            \/\/ U.S. Navy method for males\n            if (gender === 'male') {\n                var bodyFat = (495 \/ (1.0324 - 0.19077 * Math.log10(waist - neck) + 0.15456 * Math.log10(height))) - 450;\n            } \n            \/\/ U.S. Navy method for females\n            else {\n                var bodyFat = (495 \/ (1.29579 - 0.35004 * Math.log10(waist + hip - neck) + 0.221 * Math.log10(height))) - 450;\n            }\n\n            var result = document.getElementById('result');\n            result.innerHTML = 'Your estimated body fat percentage is ' + bodyFat.toFixed(2) + '%.';\n        }\n\n        document.getElementById('gender').addEventListener('change', function() {\n            var gender = this.value;\n            if (gender === 'female') {\n                document.getElementById('hipGroup').style.display = 'block';\n                document.getElementById('neckGroup').style.display = 'block';\n            } else {\n                document.getElementById('hipGroup').style.display = 'none';\n                document.getElementById('neckGroup').style.display = 'block';\n            }\n        });\n    <\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Body Fat Calculator Gender MaleFemale Height (cm) Waist Circumference (cm) Neck Circumference (cm) Hip Circumference (cm) (For Women Only) Calculate<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-768","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages\/768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/comments?post=768"}],"version-history":[{"count":0,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages\/768\/revisions"}],"wp:attachment":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/media?parent=768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}