var localData = {
setLocal: function (name, value) {
var name = encodeURIComponent (name),
value = encodeURIComponent (value);
if (typeof Storage != "undefined" ) {
localStorage[name] = value;
} else {
var nowDate = new Date ().getTime(),
expiresDate = nowDate + 1000 *60 *60 *24 *7 ,
expiresDateTime = Date (expiresDate);
document.cookie = name +"=" + value +"; expires=" + expiresDateTime +"; path=/" ;
}
},
getLocal: function (name) {
var name = encodeURIComponent (name);
if (typeof Storage != "undefined" ) {
return localStorage[name];
} else {
var name = name + "=" ;
var ca = document.cookie.split(';' );
for (var i=0 ; i<ca.length; i++) {
var c = ca[i].trim();
if (c.indexOf(name)==0 ) return decodeURIComponent (c.substring(name.length,c.length));
}
return "" ;
}
},
delLocal: function (name) {
var name = encodeURIComponent (name);
if (typeof Storage != "undefined" ) {
localStorage.removeItem(name);
} else {
document.cookie = name +'=""; expires=' + new Date (0 ) +'; path=/' ;
}
}
}
localData. setLocal("code" , data . winningNumbers);
var code = localData. getLocal("code" );
localData. delLocal("code" );