Set a Cookie





11
Date Submitted Sun. Oct. 9th, 2005 8:12 PM
Revision 1 of 1
Coder mattrmiller
Tags Cookie | JavaScript | Set
Comments 0 comments
Set a Cookie
function SetCookie(strName, strValue, nExpires)
{
        // Declare variables
        var dExpires = new Date();
        var nTime = (dExpires.getTime() + (24 * 60 * 60 * 1000 * nExpires));
       
        // Set expires
        dExpires.setTime(nTime);
       
        // Set cookie
        document.cookie = strName + "=" + escape(strValue) + "; expires=" + dExpires.toGMTString();
}

Matthew R. Miller

www.bluecreststudios.com
=================
Matthew R. Miller

http://bluecreststudios.com
http://www.codeandcoffee.com

Comments

There are currently no comments for this snippet.

Voting