高仿163网站广告弹出层(每天定时24小时弹出一次)

高仿163网站广告弹出层(每天定时24小时弹出一次) 这里和京东首页定时弹出广告功能一样;用JS实现网站首页弹出广告;超级炫酷的定时弹出图片广告;淘宝网站广告弹出层实现。

<html class="hb-loaded">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
 <script src="./jquery.js"></script>
 <style>
 /*全局广告样式Start*/
 #globalAd{ width:600px; height:400px; overflow:hidden;position:fixed;display:none;margin:0 auto;z-index:10001}
 .layer{width:100%; height:100%; position:fixed; top:0px;left:0px;filter:alpha(opacity=50);opacity:0.5;background:#000;z-index:1000;display:none}
 .globalContent{width:600px; height:400px;}
 .globalContent img{max-width: 600px;height: 400px;}
 .closeIco{width:400px;height:50px;margin-left: 20px;position: absolute;left: 345px;cursor:pointer;background:url("http://pics.rebatesme.com/newrm/images/cha.png") no-repeat scroll 190px 0;}
 /*全局广告样式End*/
 </style>
</head>
<body >
<div style="width:2000px;height:2500px;background:#fcc;"></div>
<!--全局广告开始-->
<div class="layer" style="display: none;"></div>
<div id="globalAd" style="top: 266.5px; left: 651.5px; display: none;">
 <span onclick="closeGlobalAd();" class="closeIco"></span>
 <a href="#" target="_blank" class="globalContent" onclick="redirectUrlToActive();"><img src="./get_vip.png"></a>
</div>
<!--全局广告结束-->
<script>
 /*全局广告开始*/
 //=================================================================jquery.cookie Start=======================================
 jQuery.cookie = function(name, value, options) {
 if (typeof value != 'undefined') { // name and value given, set cookie
 options = options || {};
 if (value === null) {
 value = '';
 options.expires = -1;
 }
 var expires = '';
 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
 var date;
 if (typeof options.expires == 'number') {
 date = new Date();
 var totalTime = 24*3600;
 /*var totalTime=(1440-79)*60;*/
 var hour=date.getHours();
 var minutes=date.getMinutes();
 var seconds=date.getSeconds();
 var pastTime=3600*hour + 60*minutes + seconds;
 var leftTime=totalTime-pastTime;
 date.setTime(date.getTime() + (options.expires * leftTime * 1000));
 } else {
 date = options.expires;
 }
 expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
 }
 // CAUTION: Needed to parenthesize options.path and options.domain
 // in the following expressions, otherwise they evaluate to undefined
 // in the packed version for some reason...
 var path = options.path ? '; path=' + (options.path) : '';
 var domain = options.domain ? '; domain=' + (options.domain) : '';
 var secure = options.secure ? '; secure' : '';
 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
 } else { // only name given, get cookie
 var cookieValue = null;
 if (document.cookie && document.cookie != '') {
 var cookies = document.cookie.split(';');
 for (var i = 0; i < cookies.length; i++) {
 var cookie = jQuery.trim(cookies[i]);
 // Does this cookie string begin with the name we want?
 if (cookie.substring(0, name.length + 1) == (name + '=')) {
 cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
 break;
 }
 }
 }
 return cookieValue;
 }
 };
 //================================================================jquery.cookie End===========================================================================
 $(function() {
 //Set the popup window to center
 var COOKIE_NAME = "dev21dscn";
 if($.cookie(COOKIE_NAME)){
 $(".layer").hide();
 $("#globalAd").hide();
 }else{
 var erdangjiadeH = $(window).height();
 var erdangjiadeW = $(window).width();
 $(".layer").show();
 $("#globalAd").css({'top': erdangjiadeH/2-$("#globalAd").height()/2,'left': erdangjiadeW/2-$("#globalAd").width()/2 });
 $("#globalAd").slideDown(300, function() {
 setTimeout("closeGloableAd()", '300000');
 });
 $.cookie(COOKIE_NAME,"dev21dscn", {path: '/', expires: 1});
 }
 });
 //关闭全局广告方法
 function closeGlobalAd(){
 $('#globalAd').hide();
 $('.layer').hide();

 }
 //跳转广告方法
 function redirectUrlToActive(){
 $('#globalAd').hide();
 $('.layer').hide();
 }
 /*全局广告结束*/
</script>
</body></html>

资源下载: 本地下载

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注