-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattenddance.html
95 lines (88 loc) · 2.83 KB
/
attenddance.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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Attendance Calculator</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #000;
color: #0f0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: #111;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 255, 0, 0.5);
width: 90%;
max-width: 400px;
}
h1 {
text-align: center;
margin-bottom: 20px;
color: #0f0;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 2px solid #0f0;
border-radius: 5px;
background-color: #222;
color: #0f0;
}
button {
width: 100%;
padding: 10px;
background-color: #0f0;
color: #000;
border: none;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0a0;
}
.result {
text-align: center;
margin-top: 20px;
font-size: 1.2em;
}
</style>
</head>
<body>
<div class="container">
<h1>Attendance Calculator</h1>
<label for="total-classes">Total Classes</label>
<input type="number" id="total-classes" placeholder="Enter total number of classes">
<label for="attended-classes">Classes Attended</label>
<input type="number" id="attended-classes" placeholder="Enter number of attended classes">
<button onclick="calculateAttendance()">Calculate Attendance</button>
<div id="result" class="result"></div>
</div>
<script>
function calculateAttendance() {
const totalClasses = document.getElementById('total-classes').value;
const attendedClasses = document.getElementById('attended-classes').value;
if (totalClasses <= 0 || attendedClasses < 0 || attendedClasses > totalClasses) {
alert('Please enter valid class details.');
return;
}
const percentage = ((attendedClasses / totalClasses) * 100).toFixed(2);
document.getElementById('result').innerHTML = `Attendance Percentage: <strong>${percentage}%</strong>`;
}
</script>
</body>
</html>