/    Sign up×
Community /Pin to ProfileBookmark

Calorie Counter converted

This is my second attempt at inserting a code into my FrontPage 2000 authored site. The first was successful so I’m inspired. I want to put in the Calorie Calculator I found on the javascript site. But I want to use metric. the calculation seems to be
(myDistance * myWeight) * .653
for miles and lbs. Can anyone tell me what the calculation might be for kilometres and kilograms?
Thank you

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@felgallAug 12.2005 — (myDistance * myWeight) * .653 * .45359237 / 1.60934;
Copy linkTweet thisAlerts:
@arabrabauthorAug 13.2005 — Hi Stephen

I've put the calculator on my site OK and it's working (I've amazed myself). I've changed the formula as you suggested so the part in the <head> looks like this:

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

var myWeight;

var myDistance;

function HowMany(form) {

var difference;

difference = (myDistance * myWeight) * .653 * 45359237 / 1.60934;

form.Fdiff.value = difference;

if (difference < 100) {

form.comment.value="You better start working!";

}

if (difference > 101 && difference < 200) {

form.comment.value="Nice run, but you can do better.";

}

if (difference > 201 && difference < 300) {

form.comment.value="Very good! Push above 300 next time.";

}

if (difference > 301 && difference < 500) {

form.comment.value="Great! Your a runner.....keep it up!";

}

if (difference > 501 && difference < 700) {

form.comment.value="Bill Rogers move over!";

}

if (difference > 701) {

form.comment.value="Your my hero! Have a jelly doughnut.";


}

}

function SetMyWeight(weight) {

myWeight = weight.value;

}

function SetmyDistance(dis) {

myDistance = dis.value;

}

function ClearForm(form){

form.myWeight.value = "";

form.myDistance.value = "";

form.Fdiff.value = "";

form.comment.value = "";

}

// End -->

</SCRIPT>


but when I test the calculator by puttting in 60 (kg) X 1 (km), it tells me I've lost 1104288034.6353163 calories - and tells me I can have a jelly donut (boy, if losing weight was THAT easy, I'd have carton, no a truckload, of jelly donuts!!!).

So, how did you calculate the 45359237 / 1.60934 part of the formula? Or have I done something wrong??

Barb

PS - like your site!
×

Success!

Help @arabrab spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...