-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstudentlist.html
106 lines (101 loc) · 3.15 KB
/
studentlist.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Masai | Student List</title>
<link rel="stylesheet" href="style/adminNavbar.css">
<style>
table{
width:50%;
margin: auto;
border: 1px solid #bbb;
text-align: center;
margin-top: 50px;
}
table{
border-collapse: collapse;
border-spacing: 0;
}
th, td{
padding: 10px 20px;
border: 1px solid #ccc;
}
tbody tr td:last-child{
color: red;
}
tbody tr td:last-child:hover{
cursor: pointer;
}
</style>
</head>
<body onload="append(data)">
<div id="navbar">
<div id="navbar_div">
<img id="logo" src="https://www.masaischool.com/img/navbar/logo.svg" onclick="window.location.href='admin.html'">
<div onclick="window.location.href='lecture.html'">Lectures</div>
<div onclick="window.location.href='Assignments.html'">Assignments</div>
<div>Quizzes</div>
<div>Tickets</div>
<div>Discussions</div>
<div>Notifications</div>
<div>Electives</div>
</div>
<div id="navbar_div2">
<div id="name"></div>
<button id="logout" onclick="window.location.href='login.html'">LOG OUT</button>
</div>
</div>
<div id="sub_navbar">
<div>Student List</div>
<div>
<button id="addstudent" onclick="window.location.href='addstudent.html'">Add Student</button>
</div>
</div>
<table>
<thead>
<tr>
<th>Name</th>
<th>MasaiId</th>
<th>Email</th>
<th>UserName</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</body>
</html>
<script src="script/adminNavbar.js"></script>
<script>
let data = JSON.parse(localStorage.getItem("student_data")) || [];
append=(data)=>{
let container=document.querySelector("tbody");
container.innerHTML=null;
data.forEach((el,i)=>{
let trs=document.createElement("tr");
let name=document.createElement("td");
name.innerText=el.Name;
let id=document.createElement("td");
id.innerText=el.masaiid;
let email=document.createElement("td");
email.innerText=el.email
let username=document.createElement("td");
username.innerText=el.username;
let button=document.createElement("td");
button.innerText='Remove';
button.addEventListener("click",()=>{
deletes(el,i);
})
trs.append(name,id,email,username,button);
container.append(trs);
})
}
deletes=(el,i)=>{
data.splice(i,1);
localStorage.setItem("student_data",JSON.stringify(data));
window.location.reload();
}
</script>