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

来源:互联网 发布:台湾可以用淘宝吗 编辑:程序博客网 时间:2024/06/10 19:04

兼容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;" onclick="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";}


原创粉丝点击