兼容IE6的网页广告右下角浮动 JS代码

兼容IE6的广告右下角浮动:



document.getCookie = function(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
      return decodeURIComponent(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}



function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	if(cookieValue == '' || seconds < 0) {
		cookieValue = '';
		seconds = -2592000;
	}
	expires.setTime(expires.getTime() + seconds * 1000);
	domain = !domain ? '' : domain;
	path = !path ? '' : path;
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}

function getcookie(name, nounescape) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	if(cookie_start == -1) {
		return '';
	} else {
		var v = document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length));
		return !nounescape ? unescape(v) : v;
	}
}


/* 24hour */
function popLog() {
    setcookie('popShowed','YES',3600*24);
}

function popToday() {
    return getcookie('popShowed') == 'YES' ? true:false;
}


if(!popToday()) {
    document.write('<div style="width:310px;height:322px;position:fixed;bottom:0px;right:0px;border:solid 1px #444;margin:0;padding:0;background:#fff;" id="ad423biao"><div style="height:12px;font-size:12px;text-align:right;"><span style="cursor:pointer;margin:0;padding:0;line-height:12px;" οnclick="closead423biao()">×</span></div><iframe marginwidth="0" marginheight="0" frameborder="0" scrolling="no" src="/ad/ad.html" width="310" height="310"></iframe></div>');
    var isIE = (document.all) ? true : false;
    var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
    if (isIE6)
    {
    	var ad423biao = document.getElementById("ad423biao").style;
    	ad423biao.position = "absolute";
    	ad423biao.bottom = "0px";
    	ad423biao.right = "0px";
    	window.setInterval(moveR, 80);
    }

    popLog();
}

function moveR()
{
	var ad423biao = document.getElementById("ad423biao").style;
	ad423biao.marginBottom = "0px";
	ad423biao.left = ( document.documentElement.scrollLeft + document.documentElement.clientWidth - 312) + "px";
}

function closead423biao()
{
	var ad423biao = document.getElementById("ad423biao").style;
	ad423biao.display="none";
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值