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 に答える