Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
<script>
function setCookie() {
var today = new Date();
var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
tomorrow1 = tomorrow;
var a = tomorrow1.getDay();
switch (a) {
case 0:
txt = "Sun";
break;
case 1:
txt = "Mon";
break;
case 2:
txt = "Tue";
break;
case 3:
txt = "Wed";
break;
case 4:
txt = "Thu";
break;
case 5:
txt = "Fri";
break;
case 6:
txt = "Sat";
break;
}
var a = tomorrow1.getMonth();
switch (a) {
case 0:
txt1 = "Jan";
break;
case 1:
txt1 = "Feb";
break;
case 2:
txt1 = "Mar";
break;
case 3:
txt1 = "Apr";
break;
case 4:
txt1 = "May";
break;
case 5:
txt1 = "June";
break;
case 6:
txt1 = "July";
break;
case 7:
txt1 = "Aug";
break;
case 8:
txt1 = "Sept";
break;
case 9:
txt1 = "Oct";
break;
case 10:
txt1 = "Nov";
break;
case 11:
txt1 = "Dec";
break;
}
var b = tomorrow1.getDate();
var c = tomorrow1.getFullYear();
var d = document.getElementById("text1").value;
var y = "" + d + "; expires=" + txt + ", " + b + " " + txt1 + " " + c + " 12:00:00 UTC; path=/";
document.cookie = y;
alert("My cookie is set: " + y);
}
function setCookie1() {
var x = document.cookie
alert(x);
}
</script>
</head>
<body>
<input type="text" id="text1" value="This is my cookie"/>
<button onclick="setCookie()">create cookie</button>
<button onclick="setCookie1()">check cookie</button>
<div id="div1"></div>
</body>
</html> 
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507