Simple calculation doesn't work

I have an input for Fahrenheit in degrees, then a button to start the calculations, then an input box for the result. But the result stays empty. Can you please tell me where my Javascript code went wrong? I am modifying someone else’s code form the Internet, and frankly I am guessing at how it works.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<SCRIPT LANGUAGE="JavaScript">

<!-- Original: Rick Johnson -->
<!-- Web Site:  http://members.tripod.com/~RickJohnson -->
<!-- Script from http://javascript.internet.com/math-related/5-function.html -->

}
<!-- (Fahrenheit - 32) divided by 1.8 = Celsius -->
function a_minus_b(form) {
a=eval(form.a.value)
c=a-32/1.8
form.ans.value=c
}

</SCRIPT>
<title>Convert Temperature</title>

</head>
<body>

    
<p>(Fahrenheit - 32) &divide; 1.8 = Celsius</p>
<br>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td class="alignright">
<FORM name="formx">Degrees Fahrenheit <input  type=text size=4 value=220 name="a">
 
<tr>
<td class="alignright">
<input type="button" value="Convert" onClick="a_minus_b(this.form)">  
</td>
</tr>

<td class="alignright">
<input size=4 type "number" name="ans" value=>
</td>
</tr>
</FORM>
</table>
</p>

</body>
</html>

post the error message you are getting

I’m playing this back in the iPhone Simulator or on my iPod touch device. I’m not getting any error messages.

Thanks,
Steve

ok, then to help you debug it you will need to run it in one of the main browsers (preferably Firefox) on some kind of desktop or laptop pc.

I’m getting syntax errors running it my IE

OK, I kept fiddling with it and got it to work with these JS changes:

<FORM name="form">Degrees Fahrenheit <input type=text name=a size=4 value="">

<input type=button value=Convert onClick="a_minus_b(this.form)">  

<input size=4 type=number name=ans value="">