dzLib.js
|
Client-side cookies | |
|
Description: Usage:
//Test is cookies are enabled
if(testCookie())
{
//Save a cookie, called 'userName' with value 'Your Name',
//and let it expire after 2 months.
setCookie('userName','Your Name',getExpireDate('m',2));
}
//Do the same, but cookie expires when browser (session) is closed.
//The function also returns a boolean value to indicate if the
//cookie was saved successfull.
if( !setCookie('userName','Your Name') )
{
alert('Saving of the cookie didn\'t succeed');
}
//And show an alert with the value of the cookie
alert( getCookie('userName') );
Live Demo:Setting cookies seems to be disabeld. Enable the function and reload the form to run this demo (just enable this freaking form). |