setCookie('g20', 'noshow'); //设置cookie if(address.indexOf('西藏')==0 && (getCookie('g20') != 'noshow' || getCookie('g20') == null)){ //执行语句 } $.ajax({ type:"GET", url:"/user.php?a=logout", async:false, data:"", dataType:'json', success:function(result){ delCookie('g20'); } });
//删除cookie function delCookie(c_name){ var exdate=new Date() exdate.setDate(exdate.getDate() - 1) document.cookie = c_name + '=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT'; }