Converting inches to cm and vice versa

Inches (In)
Inches to Cm conversion
Centimeters (Cm)

How this script works

When we enter any number at inches textbox ,we used onblur and onkeyup events to run the functions written to convert inches to cm in_to_cm().

Similarly when we enter any data at centimetre textbox, it fires the function written to convert CM to Inches cm_to_in() by using onblur and onkeyup events.

Inside the functions we used simple mathematical conversion formulas to arrive at the result and display the same using getElementById()
<script language=JavaScript>
function in_to_cm()
var v_in=document.getElementById("t_in").value;
var v_cm=v_in*2.54;

function cm_to_in()
var v_cm=document.getElementById("t_cm").value;
var v_in=v_cm*0.39370079;


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 All rights reserved worldwide Privacy Policy Disclaimer