-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconverter.html
28 lines (26 loc) · 951 Bytes
/
converter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- Question-1 : Input the distance in Kilometer and Convert into Meter and Centimeter. -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text" name="" id="convert" placeholder="Enter the distance in KMs">
<button id="btn">Convert</button>
<div id="results"></div>
<script>
let converts = document.getElementById('btn')
let inputItem = document.getElementById('convert')
// let result = document.getElementById('results')
converts.addEventListener('click', function(){
let theInput = inputItem.value * 1000;
let inputInCm = theInput * 100;
// console.log(theInput + "Meters")
// console.log(inputInCm + "CMs")
document.getElementById('results').innerHTML = (`${theInput} Meters and ${inputInCm} Cms`)
}); //
</script>
</body>
</html>