topical media & game development

talk show tell print

lib-js-math-calculator-bmi-metric.htm / htm



  
  <!-- TWO STEPS TO INSTALL METRIC BMI CALCULATOR:
  
    1.  Copy the coding into the HEAD of your HTML document
    2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <script type="text/javascript">
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  <!-- Created by: Bob Mason :: http://www.omega-cottage.co.uk/WLS -->
  <!-- Begin
  function  calculateBMI() {
    var weight = eval(document.form.weight.value)
    var height = eval(document.form.height.value)
    var height2 = height / 100
    var BMI = weight  / (height2 * height2)
    document.form.BodyMassIndex.value=custRound(BMI,1);
  }
  
  function custRound(x,places) {
    return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
  }
  // End -->
  </script>
  </HEAD>
  
  <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <div align="center">
  <form  name="form" id="form">
  <input type="Text" name="weight" size="4"> Weight (in Kilos)  
  <input type="Text" name="height" size="4"> Height (in Centimeters)<br><br>
  <input type="Text" name="BodyMassIndex" id="BodyMassIndex" size="4"> BMI     
  <input type="button" style="font-size: 8pt" value="Calculate" onClick="calculateBMI()" name="button">
  <input type="reset" style="font-size: 8pt" value="Clear Form">
  </form>
  </div>
  
  <p><center>
  <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  1.61 KB -->
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.