Several problems. You had an extra closing } in the function which was throwing a javascript error. Also there is no such built in javascript function isNumber(), so that was blowing up. Also you have the test for the 'invalid input' in the wrong place (no point checking for valid fields when you are clearing the form).
Try this:
HTML Code:
<html>
<head>
<script type="text/javascript">
<!--
function calculate(task){
var f1 = document.getElementById("stake");
var f2 = document.getElementById("cash");
var f3 = document.getElementById("horseshare");
var f4 = document.getElementById("stakershare");
var f5 = document.getElementById("siteshare");
if(task == "compute")
{
if(isNaN(f1.value) || isNaN(f2.value))
alert("Invalid field entry!");
else
{
f5.value = f2.value *.05;
f2.value = f2.value *.95;
f3.value = f2.value/2 - f1.value/2;
f4.value = f3.value + f1.value;
}
}
if(task == "reset")
{
f1.value = "";
f2.value = "";
f3.value = "";
f4.value = "";
f5.value = "";
}
}
-->
</script>
</head>
<body>
<TABLE width=200 height=100 >
<TR>
<TD >
Amount of stake: <input type="Text" id="stake"></br>
Total Amount Cashed: <input type="text" id="cash">
</br>
<input value="Calculate" type="button" onclick="calculate('compute')"/>
<input type="button" value="Clear Fields" onclick="calculate('reset')" />
</br></br></br>
Total to be shipped to site: <input type="text" id="siteshare"></br>
Total to be shipped to staker: <input type="text" id="stakershare"></br>
Total to keep: <input type="text" id="horseshare">
</TR>
</TD>
</TABLE>
</body>
</html>
-- hugh