/
event.html
48 lines (38 loc) · 988 Bytes
/
event.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
<!DOCTYPE html>
<html>
<head>
<title>Event</title>
</head>
<body>
<!-- <h1>Events</h1>
<button
class="btn btn-primary"
type="button"
onClick="clickMe()"
>
CLICK ME
</button>
<script type="text/javascript">
var totalClicks = 0;
function clickMe(){
totalClicks++;
console.log("You have clicked the button " + totalClicks +" time(s).");
}
</script> -->
<input type="number" class="form-control" style="padding: 20px; font-size: 30px; color: black; border: 3px solid blue;">
<br />
<button class="btn btn-primary" style="background-color: blue; color: white; font-size: 20px" onclick="calculate()">
Add 100
</button>
<h1>The total is: <span >N/A</span></h1>
<script type="text/javascript">
var num = 100;
function calculate(){
var input = document.querySelector(".form-control");
var total = Number(input.value) + num;
var totalNode = document.querySelector("span");
totalNode.innerText = total;
}
</script>
</body>
</html>