-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassRoll_Search.html
More file actions
109 lines (95 loc) · 3.29 KB
/
ClassRoll_Search.html
File metadata and controls
109 lines (95 loc) · 3.29 KB
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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Information</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
background-color: #f9f9f9;
text-align: center;
}
#students-container {
max-width: 600px;
margin: 50px auto;
background-color: #ffffff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
color: #333;
}
input {
padding: 10px;
width: 100%;
box-sizing: border-box;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
display: block;
margin: 0 auto;
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#result {
text-align: left;
margin-top: 20px;
color: #333;
}
#result p {
margin: 10px 0;
}
</style>
</head>
<body>
<div id="students-container">
<h2 style="color: #333;">Student Information</h2>
<label for="rollNumber">Enter Roll Number:</label>
<input type="text" id="rollNumber" placeholder="e.g., 1">
<button onclick="showInformation()">Show Information</button>
<div id="result"></div>
</div>
<script>
const students = [
{ rollNumber: 1, name: 'John Doe', age: 18, country: 'USA', fatherName: 'James Doe', class: '12th' },
{ rollNumber: 2, name: 'Jane Smith', age: 17, country: 'Canada', fatherName: 'Robert Smith', class: '11th' },
// Add more student details as needed
// ...
{ rollNumber: 30, name: 'Sophie Brown', age: 19, country: 'Australia', fatherName: 'Michael Brown', class: '12th' }
];
function showInformation() {
const rollNumberInput = document.getElementById('rollNumber').value;
const resultContainer = document.getElementById('result');
resultContainer.innerHTML = '';
const student = students.find(s => s.rollNumber === parseInt(rollNumberInput));
if (student) {
for (const [key, value] of Object.entries(student)) {
const infoParagraph = document.createElement('p');
infoParagraph.innerHTML = `<strong>${key}:</strong> ${value}`;
resultContainer.appendChild(infoParagraph);
}
} else {
const errorParagraph = document.createElement('p');
errorParagraph.style.color = 'red';
errorParagraph.textContent = 'No information found for the specified roll number.';
resultContainer.appendChild(errorParagraph);
}
}
</script>
</body>
</html>