/ Published in: JavaScript
Set a cookie that expires at midnight.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function createCookie(name,value,path) { var expires = ""; var date = new Date(); var midnight = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59); expires = "; expires=" + midnight.toGMTString(); if (!path) { path = "/"; } document.cookie = name + "=" + value + expires + "; path=" + path; }