-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (36 loc) · 1.12 KB
/
index.js
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
import { navbar, footer, sidebar } from "./components/navbar.js";
let nav = document.getElementById("nav");
nav.innerHTML = navbar();
let foot = document.getElementById("footer");
foot.innerHTML = footer();
let side = document.getElementById("sidebar");
side.innerHTML = sidebar();
function zero() {
let bar = document.getElementById("sidebar");
bar.style.width = "0px";
}
function enable() {
let bar = document.getElementById("sidebar");
bar.style.width = "400px";
}
let x = document.getElementById("enable");
x.addEventListener("click", function () {
enable();
// console.log("hi")
});
document.getElementById("close").addEventListener("click", function () {
zero();
// console.log("hi")
});
document.querySelector(".submit").addEventListener("click", display);
function display() {
let credentials = JSON.parse(localStorage.getItem("data"));
let name = document.getElementById("name").value;
let pass = document.getElementById("pass").value;
console.log(credentials.uname);
if (name == credentials.uname && pass == credentials.pass) {
alert("Login Successfull");
} else {
alert("Wrong Credentials");
}
}