HTML and CSS Reference
In-Depth Information
The expiration date of the cookie is set to the beginning of UNIX time, also called
epoch time—January 1, 1970. Certainly this date has passed and the cookie will
be deleted. After the cookie has been deleted, the seeCookie() function will be
called, and the user will be presented with another cookie. If he or she clicks the
Yes radio button, that cookie will be removed.
The function called SeeCookie() will check to see if there are any cookies remain-
ing in the document.cookie property. If not, the program is over. To actually see if
the cookies were deleted, close this session, and then reopen it.
By splitting up the document.cookie property by semicolons, an array is created
consisting of a name and value attribute of the cookie.
The first element of the array, the name of the cookie, is assigned to the textbox
represented as document.form1.cookietype.value . It will appear in the textbox for
the user to see. Each time the function is called, the next cookie will be assigned
to the textbox, giving the user the option to delete that cookie.
When the document has finished loading, the onLoad event is triggered, and calls
the seeCookie() function. The first cookie name will appear in the textbox.
The HTML form starts here.
The textbox input type will be used to hold the cookie name.
This radio button, when clicked, will called the delCookie() function. The user
wants to remove this cookie. See Figures 16.13 and 16.14.
This radio button, when clicked, means the user doesn't want to delete this cookie
but would like to see the next cookie. When the user clicks No, the seeCookie()
function will be called. After all the cookies have been shown, the alert message
will say “ No more cookies.
Figure 16.13 The cookie's name is visitor . If the user clicks Yes (top), the cookie will
be removed (bottom).
Search WWH ::

Custom Search