Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:32:48+00:00 2026-06-07T14:32:48+00:00

The formula for calculating body mass index is weight * 703 / height². Create

  • 0

The formula for calculating body mass index is weight * 703 / height².
Create a web page that contains three text boxes: weight in pounds, height in inches, and one that will contain the BMI result. Create a script with a function named calcBMI() that performs the calculation using the values in the weight and height text boxes and assign the result of the BMI text box. Convert the result to an integer by using the parseInt() function. Reference the text boxex from within the function by using the document object, form name, and name and value attributes of each text box (don’t use function arguments). Perform the calculation by calling the function from onclick event in a button element.

This what I could come up with:

<html><head>
<title>...</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<script type="text/javascript">
/*<CDATA[[*/

function calcBMI(){
var weight, height, total;
document.form.height.value = weight * 703;
document.form.weight.value = (height * height);
var total = weight / height;
document.form.result.value = total;
}
/*]]>*/
</script>
</head>
<body>
<form name="form">
Weight: <input type="text" name="weight" /><br />
Height: <input type="text" name="height" /><br />
Result: <input type="text" name="result" /><br />
<input type="button" value="BMI Result!" onclick="calcBMI()" />
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:32:49+00:00Added an answer on June 7, 2026 at 2:32 pm

    Generally the problem you are facing is you are trying to assign values to the text boxes when you should be trying to take the values of the text boxes. Change your code to:

    function calcBMI(){
      var weight, height, total;
      weight = document.form.weight.value; //take the value from the text box
      height = document.form.height.value; //take the value from the text box
      total = weight * 703 / height / height; //your formula
      document.form.result.value = parseInt(total); //assign the last text box the result
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a formula for calculating the percentage difference between two
What is the formula for calculating the distance between 2 geocodes? I have seen
Is there a tool or a formula for calculating man-hours required for a certain
I'm calculating pi using a long winded formula. I'm trying to get more familiar
What formula would I use in a persisted column so that I can add
I have a simple HTML Form that allows the user to enter some text
I am writing a small utility for calculating a complicated mathematical formula (using commons-math
I have a standard formula for calculating loan amortization schedule. Here is the formula:
I was asked by my boss to create a module for calculating reverse compound.
I am trying to use GNU coreutil top's formula for calculating CPU usages in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.