A Name Tracker
Once again, you'll need to copy the cookie function script from the previous section and paste it in the
<HEAD>...</HEAD> portion of your HTML document. The following script asks the user for his or her name, and "remembers" the input. It then welcomes the user each time he or she accesses the page, without asking again for the name. It is useful to provide a button, or another mechanism, to let the user change the name (in case several people are using the same machine, or in case the user has mistyped his or her name).
Note that this script can be placed anywhere on the page. It welcomes the user by printing some text where you placed the script.
Use the following buttons to play around with the cookie:
Here's the code for these buttons, and the corresponding script:
Play around with the preceding buttons, while trying various options. Be sure to reload the page to see the name updated.
Created: December 4, 1997
Revised: December 4, 1997