<html>
<head>
<style>
#table.my-table{
border-color: #FFCC00 #FFCC00 #FFCC00 #FFCC00; <!-- #BFBFBF #5A5A5A #5A5A5A #BFBFBF; -->
bgcolor: #FFCC00;
border-style: solid;
border-width: 10px;
text-align: left;
border-collapse: separate;
border-spacing: 2px;
}
table.my-table tr{
}
.my-table td{
padding:2px 7px;
border:1px solid;
border-color:#5A5A5A #BFBFBF #BFBFBF #5A5A5A ;
}
</style>
</head>
<body>
<FORM>
<center>
<table BORDER=4 BGCOLOR="#bfe3fe" >
<tr>
<td ALIGN=CENTER VALIGN=CENTER COLSPAN="7"><center><h2>Temperature Conversion Calculator</h2></center>
</td>
</tr>
<tr>
<td ALIGN=CENTER>Fahrenheit</td>
<td ALIGN=CENTER>Celsius</td>
<td ALIGN=CENTER>Kelvin</td>
<td><center><INPUT TYPE="Reset" NAME="Reset" VALUE="Reset"></center></td>
</tr>
<tr>
<td><center><INPUT TYPE="text" NAME="F" VALUE="" SIZE="6" MAXLENGTH="6" onchange="eval('C.value = ' + this.form.C_expr.value);eval('K.value = ' + this.form.K_expr.value)">
<INPUT TYPE="hidden" NAME="F_expr" VALUE="(Math.round(((212-32)/100 * C.value + 32)*100))/100;">
<INPUT TYPE="hidden" NAME="F_expr2" VALUE="(Math.round(((212-32)/100 *(K.value - 273) + 32)*100))/100; "></center></td>
<td><center><INPUT TYPE="text" NAME="C" VALUE="" SIZE="6" MAXLENGTH="6" onchange="eval('F.value = ' + this.form.F_expr.value);eval('K.value = ' + this.form.K_expr.value)">
<INPUT TYPE="hidden" NAME="C_expr" VALUE="(Math.round((100/(212-32) * (F.value - 32))*100))/100"> <INPUT TYPE="hidden" NAME="C_expr2" VALUE="(Math.round(K.value - 273))"></center></td>
<td><center><INPUT TYPE="text" NAME="K" VALUE="" SIZE="6" MAXLENGTH="6" onchange="eval('F.value = ' + this.form.F_expr2.value);eval('C.value = ' + this.form.C_expr2.value)">
<INPUT TYPE="hidden" NAME="K_expr" VALUE="(Math.round((100/(212-32) * (F.value - 32))*100))/100 + 273"></center></td>
<td><center><INPUT TYPE="button" NAME="Reset" VALUE="Calculate"></center></td>
</tr>
</table>
</center>
</FORM>
</body>
</html>
I was looking for a program to do length, volume, weight and temperature conversions for my web site. I found the first 3 written in Javascript. I tried to modify it to include temperature with no success. Then I discovered one for temperature and modified the look to match what I already had.But I have never seen computations done with html alone. I cannot find an explanation anywhere. Everything I can find says “onchange designates a Javascript to run…”
Can you point me to an explanation of :
onchange="eval('C.value = ' + this.form.C_expr.value);eval('K.value = ' + this.form.K_expr.value)">
and
VALUE="(Math.round(((212-32)/100 * C.value + 32)*100))/100;">
I understand the math. But I can’t find “eval, this form, C expr.value” used with onchange. And I can’t find “Math.round” used with VALUE.
Edited by crmamx, 15 February 2013 - 11:29 AM.












