()
| 1 | function getbmivalue(){ |
| 2 | var weight = document.getElementById('weight').value; |
| 3 | var height = document.getElementById('height').value; |
| 4 | |
| 5 | height=height*12; |
| 6 | height=height*0.025; //Now height is in meter |
| 7 | |
| 8 | var newbmivalue = weight/Math.pow(height,2); |
| 9 | newbmivalue=Math.round(newbmivalue); |
| 10 | document.getElementById('bmivalue').value=newbmivalue; |
| 11 | // checking for invalid inputs |
| 12 | if (height=== "" || isNan(height)) |
| 13 | document.getElementById('healthStatus').textContent = "Enter a valid Height"; |
| 14 | else if (weight=== "" || isNan(weight)) |
| 15 | document.getElementById('healthStatus').textContent = "Enter a valid Weight"; |
| 16 | // if both inputs are valid then calculating bmi |
| 17 | else{ |
| 18 | if(newbmivalue >= 25){ |
| 19 | document.getElementById('healthStatus').textContent = "You are overweight!"; |
| 20 | } else if (newbmivalue <= 19) { |
| 21 | document.getElementById('healthStatus').textContent = "You are underweight!"; |
| 22 | } else { |
| 23 | document.getElementById('healthStatus').textContent = "Your body is healthy and active!"; |
| 24 | } |
| 25 | } |
| 26 | } |
nothing calls this directly
no outgoing calls
no test coverage detected