0
var _history = new Array();
var _index=-1;
function updateHistory(shapeparam)
{
    _index = _index + 1;    
    _history.splice(_index,_history.length);
    _history.push(shapeparam);
}

从上面的代码中,我可以在不刷新的情况下维护历史记录,它工作正常。即使在刷新后我也想使这些值可用,请帮助我是否可以使用 javascript cookie。

4

1 回答 1

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(","));
}
于 2013-01-08T09:22:40.900 回答