Skip to content

Instantly share code, notes, and snippets.

@psycalc
Created May 16, 2016 11:21
Show Gist options
  • Save psycalc/f0ec2fcb55913dcadfd3fc1513677b10 to your computer and use it in GitHub Desktop.
Save psycalc/f0ec2fcb55913dcadfd3fc1513677b10 to your computer and use it in GitHub Desktop.
setCookies js function
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment