jquery cookie 怎样存放数组对象,还有其他方法吗?
function Menu(id,scopeid,parentid,sortname,sortpath,remarks,orderid){ //自定义对象
this.id = id;
this.scopeid = scopeid;
this.parentid = parentid;
this.sortname = sortname;
this.sortpath = sortpath;
this.remarks = remarks;
this.orderid = orderid;
}
function initMenus(xmlText){ //保存所有自定义对象到cookie
if(xmlText){
var menuitems = new Array();
var tableitems = tableParser(xmlText); //返回数组对象
for(var i=0;i<tableitems.length;i++){
var table = tableitems[i];
var id = nodeParser(table,'Id'); //抽取属性实例化Menu
var scopeid = nodeParser(table,'ScopeId');
var parentid = nodeParser(table,'ParentId');
var sortname = nodeParser(table,'SortName');
var sortpath = nodeParser(table,'SortPath');
var remarks = nodeParser(table,'Remarks');
var orderid = nodeParser(table,'OrderID');
var menu = new Menu(id,scopeid,parentid,sortname,sortpath,remarks,orderid);
menuitems.push(menu);
}
$.cookie('items',menuitems);
}
}
其中:$.cookie('items',menuitems); 无法将menuitems对象保存进cookie,各位大虾,请指教