M
MichiganMan
I have to do a simple temp conversion page in Javascript. I wrote code
that I thought was right, but it is not showing output after I click
the calculate button. Could someone PLEASE tell me what I am
missing???
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang = "en"
dir="ltr">
<head>
<title>Temperature Converter</title>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
/*
Project 9-2
*/
function calcCel(form){
form.celCon.value = ((form.far.value - 32) / 1.8));
}
function calcFar(form){
form.farCon.value = ((1.8 * form.cel.value) + 32));
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body><center>
<form name="calculator" action= "" method="get">
<h1>Temperature Converter</h1>
<table>
<tr>
<td>Fahrenheit Temperature</td>
<td><input type="text" name="far" size="6"></input></td>
<td><input type="button" value="Covert to Celsius"
onclick="calcCel(form)"></input></td>
<td><input type="text" name="celCon" size="6"></input></td>
</tr>
<tr>
<td>Celsius Tempurature</td>
<td><input type="text" name="cel" size="6"></input></td>
<td><input type="button" value="Convert to Fahrenheit"
onclick="calcFar(form)"></input></td>
<td><input type="text" name="farCon" size="6"></input></td>
</tr>
</table>
</form>
</center>
</body>
</html>
that I thought was right, but it is not showing output after I click
the calculate button. Could someone PLEASE tell me what I am
missing???
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang = "en"
dir="ltr">
<head>
<title>Temperature Converter</title>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
/*
Project 9-2
*/
function calcCel(form){
form.celCon.value = ((form.far.value - 32) / 1.8));
}
function calcFar(form){
form.farCon.value = ((1.8 * form.cel.value) + 32));
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body><center>
<form name="calculator" action= "" method="get">
<h1>Temperature Converter</h1>
<table>
<tr>
<td>Fahrenheit Temperature</td>
<td><input type="text" name="far" size="6"></input></td>
<td><input type="button" value="Covert to Celsius"
onclick="calcCel(form)"></input></td>
<td><input type="text" name="celCon" size="6"></input></td>
</tr>
<tr>
<td>Celsius Tempurature</td>
<td><input type="text" name="cel" size="6"></input></td>
<td><input type="button" value="Convert to Fahrenheit"
onclick="calcFar(form)"></input></td>
<td><input type="text" name="farCon" size="6"></input></td>
</tr>
</table>
</form>
</center>
</body>
</html>