# VU HELP

Virtual University of Pakistan Study forum !

# Cs101 assignment solution

<html>

<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>

<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: 973

### 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 ..

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

## Videos

• ### html student registration form

Added by Hilal Hussain

• ### computer programming friend function in c++

Added by Hilal Hussain

• ### computer science engineering

Added by Hilal Hussain

• ### international conference of virtual university ofpakistan

Added by Hilal Hussain