Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\"Programming in JavaScript assignment \" Note : To assist you in the completion

ID: 3925469 • Letter: #

Question

"Programming in JavaScript assignment"

Note: To assist you in the completion of this assignment please review Chapter 2 (in order to figure out how to incorporate JavaScript in HTML) and Chapter 2 and 7 (to figure out how to access elements).

Create a web page that has 2 text boxes that users can enter their weight in pounds and the other to enter height in inches and a button with an onclick event that calls a function called calcBMI which performs the BMI calculation.

The expression for BMI is: Weight*703/(height*height)

Type and save your work in a document and upload to the assignment drop-box.  You do not need to include a cover sheet, but you do need to put your name, date, assignment number and instructor's name at the top of the page.

Explanation / Answer

<body>
<div>
<div>
<h1>Calculate BMI</h1>
</div>
Enter Weight(in pounds) : <br>
<input type="text" id="wgt" name="TextBox1">
<br>
Enter Height(in inches) : <br>
<input type="text" id="hgt" name="TextBox2">
<br>
Calculated BMI : <br>
<input type="text" id="txtresult" name="TextBox3">
<br><br>
<input type="button" name="clickbtn" value="Display Result">
<script type="text/javascript">
function calcBMI() {
var Weight = parseInt(document.getElementById("wgt").value);
var height = parseInt(document.getElementById("hgt").value);
                   var result = Weight*703/(height*height)
document.getElementById("txtresult").value = result;
        }
</script>
</body>