右下角浮动广告效果

	<script> 
			document.write ('<div id="aa" style="width:200px;height:200px;background:#c0c0c0;" >'+
			'  <span style="text-decoration:none;font-size:12px;">关注xxx公众账号</span>     '+
			
			'<a href="javascript:;" οnclick="hidead()" style="color:red;font-size:12px;text-align: right;">关闭</a>'+
			'<img src="${ctx}/images/weixin.jpg" width="200" height="190" border="0" alt="">'+
			'  <span style="text-decoration:none;font-size:12px;">关注xxx公众账号</span>     '+
			'</div> ');

			function scrollx(p){ 

			var d = document,dd = d.documentElement,db = d.body,w = window,o = d.getElementById(p.id),ie6 = /msie 6/i.test(navigator.userAgent),style,timer; 
			if(o){ 
			o.style.cssText +=";position:"+(p.f&&!ie6?'fixed':'absolute')+";"+(p.l==undefined?'right:0;':'left:'+p.l+'px;')+(p.t!=undefined?'top:'+p.t+'px':'bottom:0'); 
			if(p.f&&ie6){ 
			o.style.cssText +=';left:expression(documentElement.scrollLeft + '+(p.l==undefined?dd.clientWidth-o.offsetWidth:p.l)+' + "px");top:expression(documentElement.scrollTop +'+(p.t==undefined?dd.clientHeight-o.offsetHeight:p.t)+'+ "px" );'; 
			dd.style.cssText +=';background-image: url(about:blank);background-attachment:fixed;'; 
			}else{ 
			if(!p.f){ 
			w.onresize = w.onscroll = function(){ 
			clearInterval(timer); 
			timer = setInterval(function(){ 
			//双选择为了修复chrome 下xhtml解析时dd.scrollTop为 0 
			var st = (dd.scrollTop||db.scrollTop),c; 
			c = st - o.offsetTop + (p.t!=undefined?p.t:(w.innerHeight||dd.clientHeight)-o.offsetHeight); 
			if(c!=0){ 
			o.style.top = o.offsetTop + Math.ceil(Math.abs(c)/10)*(c<0?-1:1) + 'px'; 
			}else{ 
			clearInterval(timer); 
			} 
			},10) 
			} 
			} 
			} 
			} 
			} 
			scrollx({ 
			id:'aa' 
			}) 
			scrollx({ 
			id:'bb', 
			l:0, 
			t:200, 
			f:1 
			}) 
			/* 
			id 你要滚动的内容的id 
			l 横坐标的位置 不写为紧贴右边 
			t 你要放在页面的那个位置默认是贴着底边 0是贴着顶边 
			f 1表示固定 不写或者0表示滚动 
			*/ 
			function hidead()
			{
				
				
				document.getElementById("aa").style.display="none";

			}
			</script> 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值