• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Math Related / Weight Watchers Points Calculator

Weight Watchers Points Calculator

Weight Watchers Points Calculator

General

Are you designing a diet Web site? Are you using the Weight Watchers Points plan to lose weight? If so, this little calculator might just come in handy. A simple but quick method to figure WW points.

Calories:
Fat:
Fiber:
 
Points:

Notes

  • Created by: Webmilhouse
  • Web Site: http://www.webmilhouse.com/

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: wwCalc.js

/* This script and many more are available free online at
The JavaScript Source!! http://javascriptsource.com
Created by: Webmilhouse | http://www.webmilhouse.com/ */
function calculate() {
 	var doc = document.pointCalc;
 	var points = 0;
 	var fiber = doc.fiber.value;
    if(fiber > 4) fiber = 4;
 	var fat = doc.fat.value;
 	var calories = doc.calories.value;

 	points = (calories / 50) + (fat / 12) – (fiber / 5);
 	doc.result.value = Math.round(points);
}

Head

Paste this code into the HEAD section of your HTML document.

<script type=”text/javascript” src=”wwCalc.js”></script>

Body

Paste this code into the BODY section of your HTML document.

<form name="pointCalc" id="pointCalc">
<table><tr><td width="100">Calories:</td>
<td><input type="text" name="calories" size="5" style="text-align: right;" /></td>
</tr><tr><td>Fat:</td>
<td><input type="text" name="fat" size="5" style="text-align: right;" /></td>
</tr><tr><td>Fiber:</td>
<td><input type="text" name="fiber" size="5" style="text-align: right;" /></td>

</tr><tr><td> </td>
<td colspan="2"><input type="button" value="Calculate" onclick="calculate();" /></td>
</tr><tr><td><strong>Points:</strong></td>
<td><input type="text" name="result" size="5" readonly="readonly" style="border: none; text-align: right; font-weight: bold;" /></td>
</tr></table></form>

Math Related

Related Snippets:

  • The Exponent Operator
  • Calculate the nth root of a given number
  • Metric BMI Calculator
  • Check if the given number is odd

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers