Skip to content

Commit

Permalink
Update student-dashboard.html
Browse files Browse the repository at this point in the history
  • Loading branch information
PenguinHubLearning authored Sep 9, 2023
1 parent 31aab49 commit 40fe5e4
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions student-dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,57 @@
}
</style>
</head>
<html>
<head>
<title>User Profile</title>
<style>
/* Profile styling */
#user-profile {
position: absolute;
top: 10px;
left: 10px;
background-color: #333;
color: #fff;
padding: 10px;
border-radius: 5px;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<div id="user-profile">
<h2>User : <span id="profile-name">User</span></h2>
</div>

<script>
// Function to get a cookie by name
function getCookie(name) {
const cookieName = `${name}=`;
const decodedCookie = decodeURIComponent(document.cookie);
const cookieArray = decodedCookie.split(';');

for (let i = 0; i < cookieArray.length; i++) {
let cookie = cookieArray[i].trim();
if (cookie.indexOf(cookieName) === 0) {
return cookie.substring(cookieName.length, cookie.length);
}
}

return "";
}

// Get the user's profile name from the cookie
const storedName = getCookie("profileName");
if (storedName !== "") {
// Update the profile name in the HTML
const profileNameElement = document.getElementById("profile-name");
profileNameElement.textContent = storedName;
}
</script>
</body>
</html>

<body>
<div id="header">
<h1>Penguin Learning | Student Dashboard</h1>
</div>
Expand Down

0 comments on commit 40fe5e4

Please sign in to comment.