每天只加载展示一次的广告样式

演示效果:

代码如下,放在首页代码即可(首页页尾也可以)

<style>
.dialog-overlay {
  background: #000 none repeat scroll 0 0;
  display: none;
  left: 0;
  min-width: 990px;
  opacity: 0.6;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 1000096;
}
.new-user {
  display: none;
  left: 30%;
  margin-left: -300px;
  margin-top: -160px;
  position: fixed;
  top: 30%;
  z-index: 1000097;
}
.new-user .new-pic {
  height: 653px;
  overflow: hidden;
  width: 1014px;
}
.new-user img {
  display: block;
  height: 653px;
  width: 1014px;
}
.new-user .close {
position: absolute;
right: 0;
top: 0;
width: 32px;
height: 32px;
background: url(/images/close.png) no-repeat;       // <!.....   括号里路径是图片路径.......>
overflow: hidden;
cursor: pointer;
}
</style>
<div id="new-user" class="new-user">
<div class="new-pic">
<a name="index3_homepage1_968877808_pic01" href="javascript:void(0);">
<img src="/images/mail20160803.png" alt="致用户的一封信">              // <!.....   括号里路径是图片路径.......>
</a>
</div>
<i class="close"></i>
</div>
<div id="dialog-overlay" class="dialog-overlay" style="height:6590px;">
<div class="overlay"></div>
</div>
<!--end-->

<script languang="javascript">

$(document).ready(function (){ 
loadpopup();
$(".close").click(function (){ 
$("#dialog-overlay").css("display","none"); 
$("#new-user").css("display","none"); 
}); 
});

function openpopup(){
var new_user=document.getElementById('new-user');
var dialog_overlay=document.getElementById('dialog-overlay');
new_user.style.display="block";
dialog_overlay.style.display="block";
}
function get_cookie(Name) {
   var search = Name + "="
   var returnvalue = "";
   if (document.cookie.length > 0) {
     offset = document.cookie.indexOf(search)
     if (offset != -1) {
         // if cookie exists
        offset += search.length
         // set index of beginning of value
        end = document.cookie.indexOf(";", offset);
         // set index of end of cookie value
        if (end == -1)
           end = document.cookie.length;
        returnvalue=unescape(document.cookie.substring(offset, end))
      }
   } 
   return returnvalue;
}
function loadpopup(){
  if (get_cookie("popped")==""){
            openpopup();
var Days = 1;
var date=new Date();
date.setTime(date.getTime()+ Days*12*60*60*1000); //设置date为当前时间+1天
document.cookie="popped=yes; expires="+date.toGMTString(); //将date赋值给expires 
    }
}
</script>

素材下载见文末

给TA买糖
共{{data.count}}人
人已赞赏
技术文档

JS禁止浏览器右键查看元素或按F12审查元素自动关闭页面示例代码

2018-1-1 17:38:37

技术文档

火车头采集器闪退解决方法

2018-2-16 22:34:23

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
有新私信 私信列表
搜索