I was calculating temperatures one day trying to figure out which heatsink/fan I should get for my computer processor and got tired of converting Celcius to Fahrenheit (and visa-versa) by hand. So I thought I would build a script to take the drudgery out of it. This JavaScript will generate temperature conversion tables using parameters you specify.
As you can see, it isn't very difficult to use the scripts.
If you know a little about Javascript, you can see the functions simply return a
string containing the generated HTML code. So, you can use it like I have above,
or you can get a bit fancier and make the tables dynamic. See the example below.
Note: I did not "bullet-proof" this part by checking for proper user input. So,
if you enter garbage data, you'll get an error. And, this part of the script
will not work in Netscape prior to v6.0:
The script to accomplish the above is a bit more detailed; you can view the
source of this page if you are really interested.
Incidentally, there is another function that you may find useful called
roundFill( n , p ). It accepts two arguments: the number to
round (n) and the precision value (p).
The function will round the fractional part of the number to the precision
value. It also adds necessary zeros to the end of the number to force the level
of precision you specified. So, even if a number has no fractional part, it will
add zeros after the decimal point as necessary.