https://github.com/lianbinghua

一天弹出一次广告cookie

function setCookie(name, value, expire) {
window.document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}
function getCookie(Name) {
var search = Name + "=";
if (window.document.cookie.length > 0) {
offset = window.document.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = window.document.cookie.indexOf(";", offset);

if (end == -1)
end = window.document.cookie.length;
return unescape(window.document.cookie.substring(offset, end));
}
}
return null;
}
function register(name) {
var today = new Date();
var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*24);
setCookie("ItDoor", name, expires);
}
function openWin() {
var c = getCookie("ItDoor");
if (c != null) {
return;
}
register("xiaolin");
if($("#ad-c").find("img").attr("src") !="" && $("#ad-c").find("img").attr("src") !=undefined){
$("#ad-pop,#ad-c").show();
}


}
$(function(){
$("#js-close,#ad-pop,#ad-c").click(function(){
$("#ad-pop,#ad-c").hide();
});
});
openWin();

posted @ 2015-03-12 17:54  连冰华  阅读(293)  评论(0编辑  收藏  举报