HTML and CSS Reference
In-Depth Information
EXPLANATION ( CONTINUED )
2
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.
3
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.
4
By splitting up the document.cookie property by semicolons, an array is created
consisting of a name and value attribute of the cookie.
5
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.
6
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.
7
The HTML form starts here.
8
The textbox input type will be used to hold the cookie name.
9
This radio button, when clicked, will called the delCookie() function. The user
wants to remove this cookie. See Figures 16.13 and 16.14.
10
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