December 2013
Intermediate to advanced
384 pages
9h 54m
English
function setCookie(name, value, days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = name + "=" + value + expires + "; path=/"; }
To add a new cookie for your web site, set document.cookie = "name=value; expireDate; path;";. The expire date needs to be a date set using .toGMTString(), and the path is the path on your web site that the cookie applies to.
Read now
Unlock full access