18 lines
446 B
HTML
18 lines
446 B
HTML
|
<script>
|
||
|
var createCookie = function(name, value, days) {
|
||
|
var expires;
|
||
|
if (days) {
|
||
|
var date = new Date();
|
||
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||
|
expires = "; expires=" + date.toGMTString();
|
||
|
}
|
||
|
else {
|
||
|
expires = "";
|
||
|
}
|
||
|
document.cookie = name + "=" + value + expires + "; path=/";
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
<a href="" onclick="createCookie("earned", "cookie", 30)">Get your cookie</a>
|
||
|
|