MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

JavaScript Tutorial

Cookies in JavaScript
Previous Home Next

A cookie is a small piece of information stored as a text file on your computer, its allow you to store information on the computer of the visitor browsing your web site. Cookies are created when you use your browser to visit a website that uses cookies to keep track of your movements within the site,

A cookie can only hold string based name/value pairs (eg name=value settings ) You cannot store binary data in a cookie and cookies can be a maximum of 4kb in size each .

A cookie can consisting of four parameters:-

cookie name : its show the name of the cookie. it is the only cookie parameter that is required.

expiration date : Signifies when the cookie should expire. When this date is reached, the cookie will be automatically deleted by the web browser.

path : The URL of the page that sets the cookie.

domain : The domain that sets the cookie.

 

Syntax

document.
cookie="Cookiename=cookieValue;
expires=expirationDate;path=URL; domain=theDomain;"

Example :

<html>
<head>
<script>
function writeCookie( )
{
document.cookie = "yourName=" + name; // Create the cookie
}
</script>
</head>
<body>
<form action="" name="orderForm">
Enter your name: <input type="TEXT" name="nameField"/>
<input type="BUTTON" value="Write Cookie" onClick="writeCookie()" />
</form>
</body>
</html>

Output :

Previous Home Next