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) ÷ 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>