Using Cookies with Javascript

In the header part of the HTML document that uses cookies include the following:

<script src="">

(Textversion of the code, in case you want to modify it.)

You will then have two functions you can use for cookies.

There are three examples for the use of cookies on the example page for class 10.

Note: cookies are visible on the page on which they are set, pages in the same directory, or subdirectories of that directory. For example if a cookie is set on the page public_html/test/cookietest.html then a page in the directory public_html/ cannot see that cookie, but any web-page in public_html/test/ could.

For more advanced information see the Netscape Javascript Guide.



Marcus Schaefer
Last updated: Feburary 5th, 2001.