JavaScript Weight Converter

JavaScript Weight Converter, JavaScript Weight Converter

Demo Available Here



JavaScript Weight Converter Download free with source code - Simple Weight Converter App using HTML & JavaScript that converts kilograms to other measurements.

 

HTML Code 

 

< input id="kilogram" type="number" placeholder="Kilogram" 
oninput="KgConverter(this.value)" onchange="KgConverter(this.value)" >

< p >Tonne: < span id="Tonne" >< /span >< /p >

< p >Grams: < span id="Grams" >< /span >< /p >

< p >MiliGram: < span id="MiliGram" >< /span >

< p >MicroGram: < span id="MicroGram"< /span >< /p >

< p >Imperial Ton: < span id="Imperial Ton" >< /span>< /p >

< p >US Ton: < span id="US Ton"< /span >< /p >

< p >Stone: < span id="Stone" >< /span >< /p >

< p >Pounds: < span id="Pounds" >< /span >< /p >

< p >Ounces: < span id="Ounces" >< /span >< /p >

 

HTML Output

 

javascript weight converter, html weight converter, kilogram to other measurements

 

JavaScript Code

 

function KgConverter(value) {
   document.getElementById("Tonne").innerHTML = value / 1000;

   document.getElementById("Grams").innerHTML = value * 1000;

   document.getElementById("MiliGram").innerHTML = value * 1e+6;

   document.getElementById("MicroGram").innerHTML = value * 1e+9;

   document.getElementById("Imperial Ton").innerHTML = value / 1016;

   document.getElementById("US Ton").innerHTML = value / 907;

   document.getElementById("Stone").innerHTML = value / 6.35;

   document.getElementById("Pounds").innerHTML = value * 2.205;

   document.getElementById("Ounces").innerHTML = value * 35.274;

}

 

Note :

1e+6 = 10^6

1e+9 = 10^9

 

 

Download Source Code

Latest Updates


You May Also Like


PHP Projects

PHP Data Filter between Two Dates Project with Source Code

PHP Data Filter between Two Dates - You will learn how to filter or find data between two dates in PHP/MySQL in this project.....

PHP Projects

PHP CRUD Operation Project with Source Code

PHP CRUD Operation with MySQL & Bootstrap 5 (Create, Read, Update, Delete) - We will use INSERT, SELECT, UPDATE, and DELETE statements in MySQL, which equate to CRUD capability.....

PHP Projects

PHP Multiple Image Upload Project with Source Code

Multiple Image Upload using PHP and MySQL download free with source code - 1. Create Database and Table. 2. Create HTML Form. 3. PHP Code for Upload an Image and PHP Code for Display an Image.....

JavaScript Projects

JavaScript Stopwatch Project with Source Code

JavaScript Stopwatch Download with source code - 1. Html code for timer and buttons. 2. Javascript code for set timer, hr min, sec and start, stop and reset.....

PHP Projects

PHP Image Upload Project with Source Code

Image Upload using PHP and MYSQL download free project with source code - 1. Create Database and Table. 2. Create HTML Form. 3. PHP Code for Upload an Image and PHP Code for Display an Image.....