Metric Converter, CM into INCHES

Hi i am trying to figure out how to create something with rails that
allows me to convert cm into inches and vice versa. I know the a cm has
to be multiplied by 2.54 to make it into a inch, but i need to one field
with a centimeter field and a button, and with a click of a button it
shows the inches and click again it goes back to cm, someone please help
thanks

Is this a homework problem? What have you done so far?

kevin cline wrote:

Is this a homework problem? What have you done so far?

No its for work and so far i have used java script and can get it to
work with the calculation but i want to use onblur, so that when i move
away from the measurement_centimeter text box i can automatically get a
conversion. I have dont this so far:

<%= error_messages_for ‘measurement’ %>

Centimeter
<%= text_field 'measurement', 'centimeter' %>

Inch
<%= text_field 'measurement', 'inch' %>

this doesnt work it creates a blank box and i have to go on this then
move away to get it too work any suggestions…