• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Creating Cookies

In this case, I’ll create an example that will enable us to store a cookie, retrieve it, and delete it. With a great burst of originality, I’ll call this cookie cookie1, and give it the text Here is the cookie data!. To set this cookie, I’ll create a function named setCookie, and just assign the cookie data pair to document.cookie:

function setCookie() 
{ 
    document.cookie = 
        "cookie1=Here is the cookie data!;" 
        . 
        . 
        . 
} 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint