Cookie Lab

[About this lab | Exercises ]

You may register to receive regular updates about this page by providing your email address:

Your Email

About This Lab

wpe51.jpg (57756 bytes)

All of the cookie functions are in the script file cookies.js.
The list of Newsworthy items in the "What's New" list is generated by the functions in the script file whats_new.js
The JavaScript Date() object gets the current time and date from the client operating system
When a visitor comes to the site, a cookie is set with the date of their visit
The cookie is read and compared to the list of "what's new"
Any new items (date of the news item is greater than last visit) are displayed in a pop-up window
If this is their first time visit, then give them all the news.

Exercises

  1. Review the "what's new" script on this page
  2. Adjust the date on your computer and test the script
  3. Add a new event to whats_new.js
  4. Write a function on  this page which takes the email address out of the text box and displays that in an alert after pushing the "register" button
  5. Now instead of displaying the email address in an alert, write it in a cookie.
  6. Advanced: When they push the "unregister" button, delete the cookie