Javascript cookies - Javascript Views : 246
Tagged in : Javascript
0 0
Send mail
Javascript Cookies:

Cookies are small text files stored in your browser. Cookies can be read by JavaScript too.
Javascript Cookies contains some data:
1. A name-value pair containing the actual data
2. An expiry date after which it is no longer valid
3. The domain and path of the server it should be sent to

document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();


Example:
var expires = new Date();
expires.setDate(expires.getDate() + 7); // 7 = days to expire
document.cookie = "name=test;expires=" + expires.toGMTString();
By Ramya, On - 2010-01-28



    Login to add Comments .