OLPCities/Cookie: Difference between revisions
No edit summary |
No edit summary |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This library is part of the <b>Gamelib</b>, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the [http://www.gnu.org/copyleft/lgpl.html GNU Library General Public Licence]. |
This library is part of the <b>Gamelib</b>, created by Scott Porter and updated by Brent Silby. Gamelib is available under the terms of the [http://www.gnu.org/copyleft/lgpl.html GNU Library General Public Licence]. |
||
To use this library (this Class) add |
To use this library (this Class) add one line to the <HEAD> section of the web page of the Lot. |
||
<pre> |
|||
⚫ | |||
<script language="Javascript" src="http://www.dmu.com/olpc/gamelib_core.js"></script> |
|||
</pre> |
|||
⚫ | |||
[http://www.dmu.com/olpc/gamelib_core.js gamelib_core.js ] |
[http://www.dmu.com/olpc/gamelib_core.js gamelib_core.js ] |
||
Line 15: | Line 12: | ||
</pre> |
</pre> |
||
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 |
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 <b>null</b> |
||
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: |
To create an "object" of the Class you need to define two names: |
||
Line 29: | Line 28: | ||
erase() Destroy the cookie. After this, the cookie will no longer exist |
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 |
When you add new data to a cookie, it loses its old data |
||
Line 36: | Line 35: | ||
==Property== |
==Property== |
||
<pre> |
<pre> |
||
value It's a "read" property. Has the data. |
value It's a "read" property. Has the data. |
||
</pre> |
</pre> |
||
[[Category:OLPCities_JavaScript_Libraries]] |
Latest revision as of 23:39, 13 February 2007
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:
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.