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

Chapter 3 project 3-2 create a web page that you van use to calculate your targe

ID: 3647560 • Letter: C

Question

Chapter 3 project 3-2
create a web page that you van use to calculate your target heart rate. Use a form that contains a text box in which users can enter their age, and a command button that uses an onclick event handler to call a function named calcHeartRate (). Within the calcHeartRate (), include a statement that calculate the maximum heart rate and assigns the result to a variable. Use two other statements that calculate minimum (50%)and maximum(85%) target heart rates. To calculate minimum target heart rate, maximum heart rate *.5 and to calculate To calculate maximum target heart rate, maximum heart rate *.85. After you calculate min and max target heart rate. display the result in another text box in the form.

This is the just of it, the part I can't seem to get is how to get the min and max targeted heart rate in the last text box to come up, in to box. I can get it with the window.write but not in the box. please help this is what I have:

<!DOCTYPE html>
<html>

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Calculate Heart Rate</title>

<script type="text/javascript">
function calcHeartRate (result)
{
//window.alert ("It is Calculated");
var age=document.HeartRate.EnterAge.value;
var maxRate=220-age;
//window.alert (maxRate);
var targetMin=maxRate*.5;
var targetMax=maxRate*.85;
//window.alert (targetMin);
//window.alert (targetMax);


}

</script>
</head>

<body>

<form action=""name="HeartRate" method="post" >
Enter your age:<input name="EnterAge" size="20" type="text">
<br><br>
Please press calculate:<input name="CalculateHeart" type="button" value="Calculate">
<br>
<br>
<input name="minMax" type="text">
</form>

</body>

</html>

Explanation / Answer

Note:- One common formula for calculating maximum heart rate is to subtract your age from 220 function calcHeartRate() { var max=0,min=0,result=0,sub=220, // Initialize some variables age=document.getElementById('age'), // Textbox that accepts the age show=document.getElementById('result'); // Textbox to show the result age=Number(age.value); if(isNaN(age)) alert('Please provide a number.'); // If not a number else { max=(sub-age)*(0.85); // Get the max heart beat min=(sub-age)*(0.5); // Get the min heart beat max=(Math.floor(max)); // Round downwards to the nearest integer min=(Math.floor(min)); // Round downwards to the nearest integer show.value=min+' to '+max+' beats per minute'; } } Age: please dont hesitate to comment.help me improve
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote