OLPCities/Cookie

From OLPC
< OLPCities
Revision as of 23:39, 13 February 2007 by Jacobolus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This library is part of the Gamelib, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the GNU Library General Public Licence.

To use this library (this Class) add one line to the <HEAD> section of the web page of the Lot.

You need to click this link and "save" the library at the same folder of the web page or put it at another folder at the same server and make a reference:

gamelib_core.js

If you put it at the same folder, the line would be:

<script language="Javascript" src="gamelib_core.js"></script> 

Cookies are small data storage containers in the visitor's browser. You can use up to 20 cookies per visitor. A cookie must have an unique name assigned to it. You do this when you create the cookie object. If a cookie with the name you use already exists, then your cookie object will have it's value set to whatever you set it to the last time the visitor was at your site. If not, the cookie's initial value will be null

A cookie has an "expiration date". Our cookies expires if it is not updated by 999999 seconds (aprox. 11 days).

To create an "object" of the Class you need to define two names:

someName = new Gl_cookie("somename2"); 

You only will use the first name for "prefix" to call the elements of the Class.

Methods

erase()              Destroy  the cookie. After this, the cookie will no longer exist 

setvalue(String)     The argument to this method is the data you wish the cookie to hold. 
                     When you add new data to a cookie, it loses its old data 

Property

value                 It's a "read" property. Has the data.