-
Notifications
You must be signed in to change notification settings - Fork 0
/
evenodd.html
109 lines (75 loc) · 2.51 KB
/
evenodd.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<title>Even/Odd/Vote Chekers</title>
<style>
/* main */
.main {
height: 70vh;
width: 70vw;
background-color: #E1AFD1;
}
/* display */
#display {
background-color: #50727B;
height: 30%;
width: 90%;
margin-top: 10px;
margin-left: 30px;
border-style: groove;
border-color: black;
border-radius: 15px;
text-align: center;
}
/* button */
.submit {
height: 20%;
width: 30%;
background-color: #B47B84;
border-style: groove;
margin-left: 10px;
}
</style>
<script>
let num;
// Even/Odd
function evenoddCheckers() {
num = document.getElementById("evenodd").value;
if (num%2 ==0) {
document.getElementById("display").innerHTML = "The number is even";
}
else {
document.getElementById("display").innerHTML = " The number is odd";
}
}
// Vote
function voteCheckers() {
num = document.getElementById("age").value;
if (num >= 18) {
document.getElementById("display").innerHTML = " The person eligible for vote";
}
else {
document.getElementById("display").innerHTML = "The person not eligible for vote";
}
}
// clear
function clearfunction() {
document.getElementById("display").innerHTML = "";
}
</script>
</head>
<body>
<!--main -->
<div class="main">
<!-- display -->
<h1 id="display"></h1>
<input type="text" value="" id="evenodd"
style="background-color: #ECB159; height: 15%; width: 30%; border-style: groove; margin-left: 50px;">
<input type="text" value="" id="age"
style="background-color:#ECB159;height: 15%; width: 30%; border-style: groove; margin-left: 30px;"><br>
<br>
<button class="submit" onclick="evenoddCheckers()">Check Even/Odd</button>
<button class="submit" onclick="voteCheckers()">Check Vote</button>
<button class="submit" onclick="clearfunction()">Clear</button>
</body>
</html>