Home »
Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Javascript and Cookie

No comments
Here is the way to create, retrieve and delete cookies using JavaScript.

Overview of Cookies

Cookie is a small text file used to store information about a user visiting your site. This file is stored on their computer by the browser. In this file you can store user's customized data, login information or something like that.

To view cookies with IE: Run -> shell:cookies
To view cookies with FF: Tools/Options/ On the Privacy Tab, select Show Cookie
...

Set Cookie

Here is the javascript function to create cookie.
function setCookie(name, value, expires) {
 document.cookie = name + "=" + escape(value) 
 + ((expires == null) ? "" : "; expires=" + expires) 
 + "; path=/";
}
name: name of the cookie, you will use this name to get the cookie.
value: data, information that you want to save.
expires: time when cookie will expire (it will be deleted from the user's computer).

Validate email address using Javascript

2 comments
The function below is used to validate email address through javascript.
Hope this entry help you!
If you found any mistake or error in this entry, please let me know. I'll try to fix that a.s.a.p.
Any solution is highly appreciated!

-Share2Learn-