|
是GOOGLE的。我贴代码出来吧!
var delta=0.15
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y;
this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
for(var i=0;i<collection.length;i++)
{
var followObj = collection.object;
var followObj_x = (typeof(collection.x)=='string'?eval(collection.x):collection.x);
var followObj_y = (typeof(collection.y)=='string'?eval(collection.y):collection.y);
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = '';
}
}
function closeAd1(){
followDiv1.style.visibility='hidden';}
function closeAd2(){
followDiv2.style.visibility='hidden';}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1',888,60,'<table cellspacing=0 cellpadding=0 width=114><tr height=18><td bgcolor=ff9900 colspan=3 align=center><font color=ffffff><b>主题推荐: <a class=n6 href=javascript:closeAd1();><font color=ffffff>x</font></a></td></tr><tr><td width=1 bgcolor=ff9900></td><td><iframe id=gadframe marginwidth=0 marginheight=0 frameborder=0 scrolling=no src=http://www.******.com/adv/peixun_ad.htm#bg width=112 height=220></iframe><iframe id=gsoframe marginwidth=0 marginheight=0 frameborder=0 scrolling=no src=http://www.*******.com/adv/peixun_so.htm width=112 height=20></iframe></td><td width=1 bgcolor=ff9900></td></tr><tr height=1><td bgcolor=ff9900 colspan=3></td></tr></table>');
theFloaters.addItem('followDiv2',1,60,'<table cellspacing=0 cellpadding=0 width=114><tr height=18><td bgcolor=ff9900 colspan=3 align=center><font color=ffffff><b>主题推荐: <a class=n6 href=javascript:closeAd2();><font color=ffffff>x</font></a></td></tr><tr><td width=1 bgcolor=ff9900></td><td><iframe id=badframe marginwidth=0 marginheight=0 frameborder=0 scrolling=no src=http://cpro.baidu.com/cpro/ui/uijs.php?&uid=60535&n=oatimecpr&tm=20&cm=56&um=26&rsi0=180&rsi1=260&wn=1&hn=3&rssl0=center&rssl1=bottom&rsi2=0&rss0=&rss1=%23ffffff&rss2=%23467AD3&rss3=%23333333&rss4=%23666666&rss5=%23ffffff&rad=1&word=+window.location width=112 height=240></iframe></td><td width=1 bgcolor=ff9900></td></tr><tr height=1><td bgcolor=ff9900 colspan=3></td></tr></table>');
theFloaters.play(); |
|