You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
965 B
49 lines
965 B
2 years ago
|
<html>
|
||
|
<head>
|
||
|
<title>Cookie Test</title>
|
||
|
<script language="JavaScript" type="text/javascript">
|
||
|
// Dojo configuration
|
||
|
djConfig = {
|
||
|
isDebug: true
|
||
|
};
|
||
|
</script>
|
||
|
<script language="JavaScript" type="text/javascript"
|
||
|
src="../../dojo.js"></script>
|
||
|
<script language="JavaScript" type="text/javascript">
|
||
|
dojo.require("dojo.io.*");
|
||
|
|
||
|
var obj = {
|
||
|
help: "I'm some help!",
|
||
|
"Eggy-Yolk!": "wee be three g'",
|
||
|
doIt: function() {
|
||
|
alert("ya");
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function objprops(o) {
|
||
|
var p, a = [];
|
||
|
for(p in o) {
|
||
|
a.push(p + " : " + o[p]);
|
||
|
}
|
||
|
return a.sort().join("<br>");
|
||
|
}
|
||
|
|
||
|
dojo.addOnLoad(function() {
|
||
|
var ck = dojo.io.cookie;
|
||
|
dojo.debug("obj = " + objprops(obj));
|
||
|
ck.setCookie("foo", "bar", 30);
|
||
|
ck.setObjectCookie("obj", obj, 60, null);
|
||
|
ck.isSupported();
|
||
|
var foo = ck.getCookie("foo");
|
||
|
dojo.debug("foo = " + foo);
|
||
|
dojo.debug("obj = " + objprops(ck.getObjectCookie("obj")));
|
||
|
ck.deleteCookie("foo");
|
||
|
ck.deleteCookie("obj");
|
||
|
});
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
</body>
|
||
|
</html>
|
||
|
|