diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/examples/cookie/cookie-subcookie-example.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/examples/cookie/cookie-subcookie-example.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,174 @@ + + + + + YUI Library Examples: Cookie: Subcookie Example + + + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

+
+ + +
+ + + +
+
+
+
+

YUI Library Examples: Cookie: Subcookie Example

+
+
+ +

Note: This is YUI 3.x. Looking for YUI 2.x?

+ +
+
+
+
+ +

Cookie: Subcookie Example

+ +
+

+

This example shows how to get and set subcookies as well as using conversion functions when retrieving subcookie values.

+ +
+
+ + + + + + + + +
+
+
+ +

Subcookie Example

+

The first three lines attempt to read the values stored in subcookies of the "example" cookie:

+ +

The "name" subcookie stores a string so it is retrieved without specifying a third argument. The "today" +subcookie stores a date string, which should be converted to a Date object upon retrieval; the third argument +of getSub() is specified as a custom function that will convert the returned value into a Date object. +The "count" subcookie contains a number and is converted to an actual JavaScript number by passing in the native +Number function. If any of these subcookies don't exist, getSub() returns null (this should +be the case the first time you run the example). The retrieved values are output in the logger.

+

After that, new values are assigned to the various subcookies:

+ +

The "name" subcookie is set to "Yahoo!", the "today" subcookie is set to the value +of a new Date object, outputting its string representation, and the "count" subcookie is filled +with a random number. The next time you run the example, the subcookies should have these values.

+ +
+ +
+
+ + + +
+ +
+

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

Privacy Policy - + Terms of Service - + Copyright Policy - + Job Openings

+
+
+ + + +