试图获取 a 的值cookie
如果它设置并更新div
与cookie
value,否则生成一个80-100之间的随机数,将其设置为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);
}
没有cookie
中的方法standard jQuery http://docs.jquery.com/Main_Page.
也许代码需要jquery-cookie http://archive.plugins.jquery.com/project/Cookie或者另一个插件?
快乐编码。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)