Setting a cookie with JavaScript which expires after 24 hours
How do I run this function, so that the cookie expires in 24 hours?
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=/";
}
Thanks