我正在 mootools 中创建一个 todolist 并遇到以下问题。我将我的待办事项存储在一个 cookie 中,但问题是我无法读取我设置了多少个 cookie,因此我可以获得它们的值。
我的问题是:有什么方法可以计算我有多少 cookie,这样我就可以遍历它们并获得正确的值。
当我将 getData 放在 console.log 中时,我得到了我的 json,但我也无法从那里读取值。我做错了什么,你有什么其他的实施建议。
tnx 提前。
现在我有以下代码。
window.addEvent('domready', function(){
    $('add').addEvent('click', function(){
        var value = $('todo').value;
        var t = new Todo(value,"beschrijving",new Date(),1);
        var storeData = JSON.encode(t);
        var c = Cookie.write(value,storeData,{duration:1});
        var getData = Cookie.read(value);
        console.log(getData);
    });
});
var Todo = new Class(
    {
    initialize: function(title,description,date,isDone){
        this.title = title;
        this.description = description;
        this.date = new Date();
        this.isDone = isDone;
    },
    getTitle:function()
    {       
        return this.title;  
    },
    getIsDone:function()
    {
        return this.isDone;
    },
    setIsDone:function(value)
    {
        this.isDone = value;
    },
});