-
Notifications
You must be signed in to change notification settings - Fork 0
/
conversion.html
64 lines (57 loc) · 1.44 KB
/
conversion.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link rel="icon" href="https://maeyler.github.io/favicon.ico">
<title>Conversion </title>
<style> /* CSS comment */
body { max-width: 440px; }
#inp { width: 50px }
#out {
font-size: 18px;
background: green;
color: white;
text-align: center;
padding: 10px;
}
</style>
</head>
<body> <!-- HTML comment: Modify all items marked xxx -->
<h2 id=title>This text is not shown. Why?</h2>
C
<input type=number id=cc value=0 onChange="conversiontoF()">
 
F
<input type=number id=ff value=0 onChange="conversiontoC()">
<p id=out>This text is not shown. Why?</p>
<hr />
<b>Sample code</b>
<pre id=sample>This text is not shown. Why?</pre>
<hr />
<p>Ref: <a href="https://www.w3schools.com/js/"
target="NewTab">JS Tutorial</a>
</p>
<script>
"use strict";
// JavaScript comment
function conversiontoF() {
let c;
c = (cc.value*1.8)+32;
out.innerText = c;
console.log(c);
}
function conversiontoC() {
let f;
f = (ff.value-32)/1.8;
out.innerText = f;
console.log(f);
}
//global variable id is the HTML element with id
//const title = document.getElementById("title");
title.innerText = document.title;
sample.innerText = conversiontoF.toString() + "<br>" + conversiontoC.toString();
out.innerText=0;
</script>
</body>
</html>