Directions: Type a known value into the left column. Then click anywhere outside the cell you just filled. The answer will appear in the column to the right. JavaScript Programmers see below.
Length (feet, meters)
Area (square feet, square meters)
Mass and Weight (ounces,grams)
Liquid Volume (pints, liters)
Temperature (Fahrenheit, Celsius




inches 

millimeters  
feet 

centimeters  
yards 

meters  
miles 

kilometers  


millimeters 

inches  
centimeters 

inches  
meters 

yards  
kilometers 

miles  
square inches 

sq cm  
square feet 

sq meters  
square yards 

sq meters  
square miles 

sq kilometers  
square acres 

sq hectares  


square cm 

sq inches  
square meters 

sq yards 

square km 

sq miles  
square hectares 

sq acres  
fluid ounces 

grams  
pounds 

kilograms  
short tons 

metric tons  


grams 

fluid ounces  
kilograms 

pounds  
metric tons 

short tons  
ounces 

milliliters  
pints 

liters  
quarts 

liters  
gallons 

liters  


milliliters 

ounces  
liters 

pints  
liters 

quarts  
liters 

gallons  
Fahrenheit 

Celsius  
Celsius 

Fahrenheit 
This example actually contains very little JavaScript code. Between the and tags in this page is the one and only JavaScript function that does all the calculations. That function, named calc(), is shown below:
Each cell that the reader is allowed to type in contains an onchange event handler that's triggered after the reader types something and leaves the cell. Each cell passes passes three values to the calc() JavaScript function, 1) the value the reader typed into the cell (this.value), 2) the conversion factor needed to do the math (25.4 in the example below), and 3) the name of the field to put the result in ("cmillimeters" in the example below).
onChange="calc(this.value,25.4,'cmillimeters')"
Each field that displays an answer is made "readonly" so the user can't type over the calculated answer. To make a field readonly, make it lose the focus (blur()) as soon as it gets the focus (onfocus).