/ Published in: JavaScript
![](/img/icon_sav.png?v3)
The cookie expires the number of days from the time it is set.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }
URL: http://www.quirksmode.org/js/cookies.html
Comments
![RSS Feed for Comments RSS Icon](/images/rss.png?v3)