JavaScript Tip of the Week for November 25, 1996: Everything You Ever Wanted to Know About Cookies | Source Code | WebReference

JavaScript Tip of the Week for November 25, 1996: Everything You Ever Wanted to Know About Cookies | Source Code

JavaScript Tip of the Weekfor November 25, 1996: Source Code: Everything You Ever Wanted to Know About Cookies

What Cookies Are and How to Use Them
Storing Cookies In Arrays
Welcome New Visitors with A Special Page



This code is put in the HTML document where you want to utilitize Cookies:
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */
function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
        while (cbegin 
This code is put in the HTML document where you want to utilitize Cookies stored in Arrays:
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */
function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
        while (cbegin 
This code is put in the HTML document where you want to utilitize the Welcome page (most likely one of your main pages, where new visitors would start out):
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */
function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
        while (cbegin 
Then put this small form, which turns the welcome screen off, in the "welcome" HTML document:
<FORM>
<INPUT TYPE = "checkbox" onClick = "top.toggleWelcome()">
Don't show this welcome screen again.
</FORM>
You can also include this small link, which brings the user to the normal page by temporarily disabling the welcome cookie:
<A HREF = "javascript:top.offTemp()">Enter Main Page</A>