Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can somone add to bootstrap template to this code. Body Mass Index-BMI BMI Calculator Weight in kg Height in cm Calculate BMI Your Body Mass

can somone add to bootstrap template to this code.

Body Mass Index-BMI

BMI Calculator

Your Body Mass Index =

0.00

----------------------------

JS

var BMI = {

init: function() { BMI.buttonClick(); },

buttonClick: function() { var button = document.getElementById('btnCalculateBMI'); button.onclick = function() { BMI.checkValues(); BMI.calculateBMI(); }; },

calculateBMI: function() { var height = parseFloat(document.getElementById('height').value); var weight = parseFloat(document.getElementById('weight').value); var result = document.getElementById('result'); result.innerHTML = (weight * 100 * 100/ (height * height)).toFixed(2); },

checkValues: function() { var flag=0; var height = document.getElementById('height').value; var weight = document.getElementById('weight').value; if(!weight.match(/\S/)) { alert ('Empty value in weight'); flag=1; } if(!height.match(/\S/) && flag==0) { alert ('Empty value in height'); } }

};

window.onload = BMI.init;

---------------------

CSS

html { font: 14px Arial; }

h1 { font-size: 16px; color: #333; text-align: center; text-transform: uppercase; }

.calculator, label { background: #f7f7f7; padding: 10px; border: 1px solid #B4B4B4; border-radius: 10px; }

.calculator { width: 400px; margin: 50px auto; min-height: 300px; }

label { color: #333; display: block; font-weight: bold; margin-bottom: 10px; text-align: right; margin-bottom: 20px; }

input { border: 2px solid #CCC; border-radius: 5px; padding: 5px; width: 250px; }

button, .result span { border-radius: 10px; }

button { background: #e6b52c; border-radius: 8px; cursor: pointer; display: block; padding: 8px 25px; border: 1px solid #BEA280; color: #fff; font-weight: bold; }

button:hover { background: #dd9917; }

.bmiResult { text-align: center; margin-top: 15px; }

.bmiResult span { width: 70px; background: #F2F4F6; display: block; font-size: 24px; color: #EFAF37; padding: 12px 15px; margin: 0 auto; box-shadow: 3px 3px 4px 0 #CCC; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

2-5 How will MIS help my career?

Answered: 1 week ago