var _history = new Array();
var _index=-1;
function updateHistory(shapeparam)
{
_index = _index + 1;
_history.splice(_index,_history.length);
_history.push(shapeparam);
}
从上面的代码我可以维护历史而不刷新它工作正常。 我希望即使刷新后也可以使用这些值, 请帮助我是否可以使用javascript cookies。
答案 0 :(得分:0)
var _history = getCookie("history");
_history=_history?_history.split(","):[];
var _index=-1;
function updateHistory(shapeparam)
{
_index = _index + 1;
_history.splice(_index,_history.length);
_history.push(shapeparam);
setCookie("history",_history.join(","));
}