Previous Example-|-Next Example-|-Return to Chapter Listing

Example 13.4:
Cookies

Type some text into this box:

Now click on this button to copy the text into the cookie.txt file:

Now click on this button to copy that cookie from the cookie.txt file back into the text box.


This Web page uses the following functions to set and display the cookie: <SCRIPT LANGUAGE="JavaScript"> <!-- //========================================================================== function SetCookie(name, form) { document.cookie = name + form.txtCookie.value + ";" form.txtCookie.value = "" } //========================================================================== function ShowCookie(form) { form.txtCookie.value = document.cookie } //========================================================================== //--> </SCRIPT> Then we have this form: <FORM> <INPUT TYPE="Text" NAME="txtCookie" size=50 ROWS=10 COLS=73></TEXT><P> <I>Now click on this button to copy the text into the cookie.txt file:</I><BR> <INPUT TYPE="button" VALUE="Create Cookie" NAME="butSet" onclick="SetCookie('Cookie1', this.form);"><P> <I>Now click on this button to copy that cookie from the cookie.txt file back into the text box.</I><BR> <INPUT TYPE="button" VALUE="Display Cookie" NAME="butDisplay" onclick="ShowCookie(this.form);"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing