<html>

 <head>

  <title>Weight Calculator</title>

  <script>

   function check(){

    var x;

     x = document.getElementById('in_kg').value;

     if (isNaN(x) || x <= 0) {

      window.alert("Enter value grater than 0");

     }else{

      var num;

      num = x * 2.2046 ;

      document.getElementById('pounds').value = num;

            num = x * 1000 ;

      document.getElementById('grams').value = num;

                        num = x * 1000000 ;

      document.getElementById('mg').value = num;

      num = x * 0.0011023 ;

      document.getElementById('Us_ton').value = num;

      num = x * 35.274 ;

      document.getElementById('ounce').value = num;

     }

   }

  </script>

 </head>

 

 <body>

 <div align="center" style="margin-left: 35%; margin-right: 35%;">

  <div style="font-size: 36px; background-color:; color: deepskyblue;">Weight Converter</div>

  <p style="font-size: 20px; background-color blueviolet; margin: 5px;">Welcome to the online converter</p>

 </div>

 <form align="center">

  <table align="center">

   <tr>

    <td>

     <label>Weight in KG:</label>

    </td>

    <td>

     <input type="number" name="kg" id="in_kg">

     <input type="button" name="submit" value="Convert" onclick="check()">

    </td>

   </tr>

   <tr>

    <td>

     <label>Weight In Poundss:</label>

    </td>

    <td>

     <input type="number" name="in_g" id="pounds">

    </td>

   </tr>

   <tr>

    <td>

     <label>Grams:</label>

    </td>

    <td>

     <input type="number" name="in_p" id="grams">

    </td>

   </tr>

   <tr>

    <td>

     <label>MilliGram:</label>

    </td>

    <td>

     <input type="number" name="in_m" id="mg">

    </td>

   </tr>

   <tr>

    <td>

     <label>US Ton:</label>

    </td>

    <td>

     <input type="number" name="in_t" id="Us_ton">

    </td>

   </tr>

   <tr>

    <td>

     <label>Ounces:</label>

    </td>

    <td>

     <input type="number" name="in_o" id="ounce">

    </td>

   </tr>

  </table>

  <div id="grams"></div>

  <input type="reset" name="reset" value="Reset Form">

 

 <p>You can press Reset Button for another conversion</p>

 </form>

 </body>

</html>

Views: 1402

Replies to This Discussion

add some changes then submit

but you know vu says it not in word formate file 

tu jis format main kha ha us format main bna lain ..

good answer

bhai itna to kar sakty na

ye just coding hai 

usy html me khud karen save

and then submit

select all desired text copy it and paste in notepad and save as .html format at your accessible location and open it 

to much simple

wasim bhai aik bat btayen code accsses hone k bad jo result hai means woh puri jo diagram hai woh send krni hai naa VU ko codes to nai naa... means jo accssesable result hai just woh send krna hai naa

yes

thanks iqra 

yes of course you will send the diagram type result not the code 

thanks bhai

very best very best

RSS

Discussion Forum

CS101 assignment 2........Spring 2018

Started by mahira khan.
Last reply
by IqraZaib 2 hours ago. 2 Replies

Cs101 assignment solution

Started by Iqra Mubasher.
Last reply
by Muhammad Abdullah on Monday. 12 Replies

cs101 assingment solution 2018

Started by Muhammad Hasan.
Last reply
by + caмe4ѕтυdιeѕ May 9. 1 Reply

CS101 Assignment # 1 Due Date: 9th May, 2018

Started by + caмe4ѕтυdιeѕ.
Last reply
by + caмe4ѕтυdιeѕ May 8. 12 Replies

SPONSORED LINKS

© 2018   Created by Muhammad Anwar Tahseen.   Powered by

Badges  |  Report an Issue  |  Terms of Service