if(document.cookie.indexOf("a=hello")==-1){
// ????alert("首次打开!");
????var?t=new?Date(new?Date().getTime()+1000*60*60*24*30);
????document.cookie="a=hello;?expires="+t.toGMTString();
}else{
// ????alert("再次打开!");
this.advertisements=false
}
在加载里直接用就好了