-
Notifications
You must be signed in to change notification settings - Fork 0
/
Counting.html
56 lines (49 loc) · 1.32 KB
/
Counting.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
<!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>Decreasing </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>
Sayi
<input type=number id=inp value=0 onChange="out.innerText=value">
 
<input type=button value=decrease onClick="decreasing()">
<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 decreasing() {
let c = Number(out.innerText)-1
console.log("counter = "+c);
out.innerText = c;
}
//global variable id is the HTML element with id
//const title = document.getElementById("title");
title.innerText = document.title;
sample.innerText = decreasing.toString();
out.innerText = 0; decreasing();
</script>
</body>
</html>