1. Computing & Technology

Body Fat Calculator

3. Javascript

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Introduction HTML

The final step is to install the Javascript that does the actual calculations for the body fat calculator. All you need to do is to copy the following code and save it as fatcalc.js.

Most of that code is needed to validate the values that your visitor enters into the form in order to make sure that the values are numeric and within a reasonable range. The actual calculations themselves (if you are interested in what those formula actually are) can be found in the maleFat() and femaleFat() functions.

©2012 About.com. All rights reserved.

A part of The New York Times Company.