topical media & game development

talk show tell print

lib-js-math-calculator-heart.htm / htm

  <!-- Paste this code into an external JavaScript file named: trainRate.js  -->
  /* This script and many more are available free online at
  The JavaScript Source ::
  Created by: Larry Wiley :: */
  function alertwiththr() {
    var rhr = prompt("What is your resting heart rate?", "")
    var age  = prompt("What is your age?", "")
    var tot = 220 - +rhr+ - age
    var lowfinal = tot *.7 +  +rhr
    var hifinal = tot *.9 + +rhr
    alert("Your target heart rate is between" +" "+lowfinal+" "+ "and"+" " +hifinal)
  <!-- Paste this code into the HEAD section of your HTML document.
       You may need to change the path of the file.  -->
  <script type="text/javascript" src="trainRate.js"></script>
  <!-- Paste this code into the BODY section of your HTML document  -->
    <input type="button"Style="font: 12pt Lithos Regular;background:blue;color:white" value="Calculate Your Training Heart Rate" onclick="alertwiththr()">

(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.