尝试获取 a 的值(如果它的集合)并用该值cookie
更新 a ,否则生成一个介于 80-100 之间的随机数,将其设置为,然后更新.div
cookie
cookie
div
我收到错误:
Object function (a,b){return new e.fn.init(a,b,h)} has no method 'cookie'
这是我的代码:
$(document).ready(function(){
var thecounter = '';
if ($.cookie('thecounter') == null)
{
thecounter = $.randomBetween(80, 100);
$.cookie('thecounter', thecounter, { path: '/' });
}
else
{
thecounter = $.cookie('thecounter');
}
$('dd-counter-num').html(thecounter);
setTimeout(newtime, 5000);
});
function newtime () {
var newtime = $.cookie('thecounter') + $.randomBetween(1, 2);
$.cookie('thecounter', newtime, { path: '/' });
$('dd-counter-num').html(newtime);
setTimeout(newtime, 5000);
}