window.onload = function () {
checkCookie ();
}
function checkCookie () {
var user = getCookie ("user");
if (user!="") {
alert ("Welcome" + username + "!");
} else {
user = prompt ("Please enter your name:");
if ((user!="") & & (user! = null)) {
setCookie ("user", user, 365);
}
}
}
function setCookie (key, value, ValidityDays) {
var validity = new Date ();
validity.setTime (validity.getTime () + validityDays * 24 * 60 * 60 * 1000);
var validityUTC="expires=" + validity.toUTCString ();
document.cookie = key + "=" + value + ";" + validityUTC + "; path = /";
}
function getCookie (key) {
var keyIgual = key + "=";
var pairs = document.cookie.split (";");
for (let i = 0; i
22.11.2018 / 23:49