<input Fahrenheit = "Fahrenheit" ..>
should be: <input [B]id[/B] = "Fahrenheit" ..>
The same goes for the other input. Also, this is wrong:
answer2 = (9.0/5.0) * (temp2 + 32);
You need to add 32 AFTER the multiplication. Lastly, if you are executing convertC() simply returning the result is useless because you are not displaying anywhere. You should be assigning the result do the Fahrenheit input. The same goes for the other function.
<?xml version= "1.0: encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- homework 9.19 -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> Fahrenheit and Celsius Converter </title>
<script type = "text/javascript">
//make convertC function
function convertC()
{
//get the number form field
var field1 = document.getElementById("Celsius");
var temp1 = parseFloat(field1.value);
var answer1 = 0;
answer1 = (5.0/9.0) * (temp1 - 32);
document.getElementById("Fahrenheit").value=answer1.toFixed(1);
return answer1;
}
//make converF funtion
function convertF()
{
var field2 = document.getElementById("Fahrenheit");
var temp2 = parseFloat(field2.value);
var answer2 = 0;
answer2 = (9.0/5.0) * (temp2 + 32);
document.getElementById("Celsius").value=answer2.toFixed(1);
return answer2;
}
</script>
</head>
<body>
<h1> Fahrenheit and Celsius Converter </h1>
<table border = "1" width = "35%">
<thead>
<tr>
<td>Fahrenheit</td>
<td><input id = "Celsius" type = "text" size = "25" /></td>
<td><input type = "button" value = "Convert to Celsius"
onclick = "convertC()" </td>
</tr>
<tr>
<td>Celsius</td>
<td><input id = "Fahrenheit" type = "text" size = "25" /></td>
<td><input type = "button" value = "Convert to Fahrenheit"
onclick = "convertF()"</td>
</tr>
</table>
</body>
</html>