mirror of
https://github.com/JonasunderscoreJones/Website-v1.git
synced 2025-10-25 11:39:18 +02:00
Update index.html
This commit is contained in:
parent
69e2096274
commit
811085c29b
1 changed files with 36 additions and 0 deletions
36
index.html
36
index.html
|
|
@ -1,6 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<title>Home - Jonas_Jones</title>
|
<title>Home - Jonas_Jones</title>
|
||||||
|
<body onload="checkCookie()"></body>
|
||||||
<link rel="icon" href="https://j-onasjones.github.io/src/logo_icon.png">
|
<link rel="icon" href="https://j-onasjones.github.io/src/logo_icon.png">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
@ -299,6 +300,41 @@ function w3_close() {
|
||||||
document.getElementById("myOverlay").style.display = "none";
|
document.getElementById("myOverlay").style.display = "none";
|
||||||
}
|
}
|
||||||
var mybutton = document.getElementById("myBtn");
|
var mybutton = document.getElementById("myBtn");
|
||||||
|
|
||||||
|
function setCookie(cname,cvalue,exdays) {
|
||||||
|
const d = new Date();
|
||||||
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||||
|
let expires = "expires=" + d.toGMTString();
|
||||||
|
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(cname) {
|
||||||
|
let name = cname + "=";
|
||||||
|
let decodedCookie = decodeURIComponent(document.cookie);
|
||||||
|
let ca = decodedCookie.split(';');
|
||||||
|
for(let i = 0; i < ca.length; i++) {
|
||||||
|
let c = ca[i];
|
||||||
|
while (c.charAt(0) == ' ') {
|
||||||
|
c = c.substring(1);
|
||||||
|
}
|
||||||
|
if (c.indexOf(name) == 0) {
|
||||||
|
return c.substring(name.length, c.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkCookie() {
|
||||||
|
let user = getCookie("username");
|
||||||
|
if (user != "") {
|
||||||
|
alert("Welcome again " + user);
|
||||||
|
} else {
|
||||||
|
user = prompt("Please enter your name:","");
|
||||||
|
if (user != "" && user != null) {
|
||||||
|
setCookie("username", user, 30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue