/*点击关闭所有的广告都关闭,是因为把closeB 置为 true 了*/ var delta=0.8; var collection; var closeB=false; var isIE=!!window.ActiveXObject; var isIE6=isIE&&!window.XMLHttpRequest; var isIE8=isIE&&!!document.documentMode; var isIE7=isIE&&!isIE6&&!isIE8; function floaters() { this.items = []; this.addItem = function(id,closebuttonid,x,y,content,width) { document.write('
'+content+'
'); var newItem = {}; newItem.object = document.getElementById(id); newItem.x = x; newItem.y = y; this.items[this.items.length] = newItem; var closebutton = document.getElementById(closebuttonid); var nextsbl = closebutton.nextSibling; if(nextsbl){ closebutton.style.display = "block"; //var img_adv=nextsbl.getElementsByTagName("img"); //var img_adv_width = img_adv[0].width+"px"; closebutton.style.width = width+"px"; closebutton.onclick = function(){ this.parentNode.style.display = "none"; } } } this.play = function() { collection = this.items setInterval('play()',30); } } function play() { if(screen.width<=800 || closeB) { for(var i=0;i0?1:-1)*Math.ceil(Math.abs(dx)); followObj.style.left=followObj.offsetLeft+dx; } if(followObj.offsetTop!=((isIE6 ? document.documentElement.scrollTop : document.body.scrollTop)+followObj_y)) { var dy=((isIE6 ? document.documentElement.scrollTop : document.body.scrollTop)+followObj_y-followObj.offsetTop)*delta; dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy)); followObj.style.top=followObj.offsetTop+dy; } } } function closeBanner() { closeB=true; return; } var theFloaters = new floaters(); //左侧漂浮 //theFloaters.addItem('followDiv1','closebutton1',3,200,'',100); //右侧漂浮 theFloaters.addItem('followDiv3','closebutton3',document.documentElement.clientWidth-150,200,'',150); theFloaters.play();