To see each example:-
Click on a link below and load the example in this window.
Then to view the source code:-
Click the right mouse button over the window and then select "View Source" from the pop-up window.
If any graphics are used in the script:-
Click the right mouse button over each graphic and then select "Save Picture As" from the pop-up menu. (All of the graphics are included in the same directory as the javascript example.)
To go back to the Index:-
Click on the "Back" button at the top of your browser.
Address Book. Saves an address book database as a cookie on the user's computer. The author explains that although the actual example may not be particularly useful, the underlying code could be very beneficial for use in other projects.
Bookmark Reminder. (Best with Internet Explorer) Pops up the "Add to Favorites" bookmark window once a week, or after every certain number of days. Netscape users are given an alert message to remind them to bookmark the site.
Cookie Redirect. Let a JavaScript cookie remember your favorite background color. On future visits, it automatically displays that background color for you.
Favorite Bg. Redirects the visitor to different pages based on the value of a stored cookie. If no cookie is found, the available items are displayed for the user to pick from, which sets a cookie for their next visit. Our demonstration uses a 'favorite animal' cookie, but this could easily be modified to fit your needs.
Name Browser. This cookies records the visitor's name and also writes the visitor's browser information to the screen.
Name Visits Last Visit. This cookie records the visitor's name, how many visits, and the last visit.
Name Visits Msg. This cookie records the visitor's name, how many visits, and displays a message depending on how many visits have been recorded.
User Name. Cookies allow web pages to store information on the visitors computer and to later retrieve that information. This cookie records the visitor's name.
Only Popup Once. If you have a new window open up on your home page, it opens every time your visitors come back to that page. This is rude as well as very annoying thing to force onto your visitors. But, using cookies, this script can determine if the visitor has been here before, and only open a new window on their first visit to the page. The next time they come back, the script will read the cookie, identify them as a repeat visitor, and NOT open the window again.
Remove Ads. Catches all clicks on ads and writes a cookie on the visitor's computer. Until the cookie expires, no ads are shown.
To Do List. Keep your To Do list up to date with this script. Demonstrates how to display, add and delete items from a list of cookies.