问题描述
我正在使用js-cookie.js在单击按钮时设置cookie。那里没有问题。我需要检查是否设置了cookie,并且每次运行检查时都要增加var。如何在第二次运行该函数时递增“ x”并检查cookie和x值?
Cookies.get('NTAD');
var x ="0";
$(function(){
if(Cookies.get('NTAD') == 'true') {
$.getScript('/js/adroll.js');
} else if(Cookies.get('NTAD') != 'true' && (x = '0')) {
//here is where I fade in a banner with "Yes"(sets cookie) and "No" button
//need to increment var x here
alert(x);
x="1"
} else if(Cookies.get('NTAD') != 'true' && (x = '1')){
//second time through,x should = 1 from above and just show banner but not fade
alert(x);
}
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)