Set a cookie to expire in 1 hour


JavaScript


function setCookieHours(c_name,value,expirehours){
	var exdate= new Date();
	var time = exdate.getTime();
	time += 3600 * 1000 * expirehours;
	exdate.setTime(time);
	document.cookie=c_name+ "=" +escape(value) + ((expirehours==null) ? "" : "; expires="+exdate.toGMTString()) + ";path=/"
};

Posted by fbrefere001 on Monday September 1, 2014