I have some files that I am working on for a class. I am a little lost. The first one is supposed to calculate min and max heart rate. The second calculates shipping, and the third checks for the leap year. I have seen examples of these on the net, but I am not about just cutting and pasting. I want to understand what is going on and what I am doing wrong. So, what am I missing?
[B]Heart Rate
<script type=”text/javascript”>
/* <![CDATA[
var age = 0;
function calcheartrate(value) {
var max = 220 – age;
var maxtarget = max * .85;
var mintarget = max
document.write(“<p>” + mintarget + ” to ” + maxtarget + ” beats per minute”);
}
/* ]]>
</script>
</head>
<body>]
<div style=”text-align: center”>
<form name=”Heartrate” action=””>
<input type=”text” name=”Input” /><br />
<input type=”button” name=”calc” value=” Calculate Heart Rate ” onclick=”calcheartrate(eval(document.Heartrate.Input.value));” />
<input type=”button” name=”clear” value=” Clear ” onclick=”document.Heartrate.Input.value=”; inputString=”” />
</form>
</div>
</body>
[B]Shipping
<script type=”text/javascript”>
/* <![CDATA[
var input = “”;
var percent = .10; totalshipping = 0; price = 0;
function calcshipping(price) {
input += price;
document.Shipping.input.value = price;
if (price <= 25)
totalshipping += 1.5;
if (price > 25)
totalshipping = price * percent / 100;
window.alert(totalshipping);
}
/
</script>
</head>
<body>
<h1></h1>
<div style=”text-align: center”>
<form name=”Shipping” action=””>
<input type=”text” name=”input” /><br />
<input type=”button” name=”calcship” value=”Calculate Shipping” onclick=”calcshipping(eval(document.Shipping.input.value=”));” />
<input type=”button” name=”clear” value=”Clear” onclick=”document.Shipping.input.value=”)); price=”” />
</form>
</div>
</body>
</html>
[B]Leapyear
<script type=”text/javascript”>
/* <![CDATA[
var input = “”;
function checkyear(year) {
var year = input;
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0));
window.alert(“<p>This is a leap year</p>”);
else
window.alert(“<p>This is not a leap year</p>”);
}
/* ]]>
</script>
</head>
<body>
<div style=”text-align: center”>
<form name=”Leapyear” action=””>
<input type=”text” name=”Input” /><br />
<input type=”button” name=”calc” value=” Check Year ” onclick=”checkyear(eval(document.Leapyear.input.value))” />
<input type=”button” name=”clear” value=” clear ” onclick=”document.Leapyear.Input.value=”; input=”” />
</form>
</div>
</body>