I'm stumped as to why this code is not working. Any insights would be welcome.
Thanks
prizsm@uneedspeed.net
<html>
<head>
<title>Spanish Rice</title>
<script language="JavaScript">
var howMany = 1;
function fractionise( nFloat )
{
var nMajor = parseInt( nFloat );
var nMinor = ( nFloat - nMajor );
return ( nMajor + ( nMinor != 0 ? " 1/" + ( 1 / nMinor ) : "" ) );
}
function howmanyservings ()
{
var newServings = document.amounts;
var increase = document.servesform.howmany.value;
var ingOne = fractionise( parseInt( increase ) * parseFloat( newServings.beefbroth.value ) );
var beefBroth = document.getElementById( "beefBroth" );
beefBroth.replaceChild( ingOne, beefBroth.firstChild );
ingTwo = fractionise( parseInt( increase ) * parseFloat( newServings.brownrice.value ) );
var brownRice = document.getElementById( "brownRice" );
brownRice.replaceChild( ingTwo, brownRice.firstChild );
}
</script>
</head>
<body bgcolor=ffcc99>
<form name = "amounts">
<input type="hidden" name="beefbroth" value=".5">
<input type="hidden" name="brownrice" value=".25">
</form>
<table width=70% cellspacing=15>
<tr><td><h2><center>Spanish Rice</center></h2></td></tr>
<tr><td><center><i>serves </i><form name="servesform"> <input type="text" name="howmany" size=3 maxlength=3 value="1"></input></form><center><form name= "doit"><input type= "button" name= "multiply" value= "How many?" onclick= "howmanyservings ();"></input></form></center></td></tr>
</table>
<table cellspacing=15>
<tr><td id= "td1"><span id="beefBroth">1/2</span> cup beef broth            </td>
<td id= "td2"><span id="brownRice">1/4</span> cup brown rice</td>
</tr>
</table>
</body>
</html>