I'm not sure why, but only oranges seems to calculate in the form I created, but the other fruits I specified don't. I have the each .value specified for each fruit. The form for all fruits are logically identical from what I can see, so I don't understand why I'm not getting result from watermelon or pineapple.
<?xml version = "1.0"?>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> Purchase Orange </title>
<!-- Script for the event handlers -->
<script type = "text/javascript">
// The event handler function to compute the cost
function computeCost() {
var orange = document.getElementById("orange").value;
// Compute the cost
document.getElementById("cost").value = orange * 1.99;
var watermelon = document.getElementById("Watermelon").value;
document.getElementById("cost").value = watermelon * 4.99;
var pineapple = document.getElementById("Pineapple").value;
document.getElementById("cost").value = pineapple * 4.69;
} //* end of computeCost
</script>
</head>
<body>
<form>
Orange $1.99/lb <input type = "text" id = "orange" size ="3" />
<br />
</form>
<form>
Watermelon $4.99/lb <input type = "text" id = "watermelon" size ="3" />
<br />
</form>
<form>
Pineapple $4.69/lb <input type = "text" id = "pineapple" size ="3" />
<br />
</form>
<form>
Total Cost is <input type = "text" id = "cost" size ="5" />
<br />
</form>
<form>
<input type = "button" value = "Total Cost" onclick="computeCost();"/>
</form>
</body>