温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:勇敢者论坛1.02版源码
当前文件:
doughtyBBS102/js/duilian.js[2K,2009-6-12 11:41:20],打开代码结构图
doughtyBBS102/js/duilian.js[2K,2009-6-12 11:41:20],打开代码结构图1var delta=0.115; 2
var collection; 3
var closeB=false; 4
function floaters() { 5
this.items = []; 6
this.addItem = function(id,x,y,content) 7
{ 8
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+x+';top:'+y+'">'+content+'</DIV>'); 9
var newItem = {}; 10
newItem.object = document.getElementById(id); 11
newItem.x = x; 12
newItem.y = y; 13
14
this.items[this.items.length] = newItem; 15
} 16
this.play = function() 17
{ 18
collection = this.items 19
setInterval('play()',30); 20
} 21
} 22
function play() 23
{ 24
if(screen.width<=800 || closeB) 25
{ 26
for(var i=0;i<collection.length;i++) 27
{ 28
collection[i].object.style.display = 'none'; 29
} 30
return; 31
} 32
for(var i=0;i<collection.length;i++) 33
{ 34
var followObj = collection[i].object; 35
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x); 36
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y); 37
38
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) { 39
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta; 40
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx)); 41
followObj.style.left=followObj.offsetLeft+dx; 42
} 43
44
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) { 45
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta; 46
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy)); 47
followObj.style.top=followObj.offsetTop+dy; 48
} 49
followObj.style.display = ''; 50
} 51
} 52
function closeBanner() 53
{ 54
closeB=true; 55
return; 56
} 57
58
var theFloaters = new floaters(); 59
theFloaters.addItem('followDiv1','document.body.clientWidth-100',0,'<a onClick="closeBanner();" href=http://www.binhaistar.com target=_blank><img src=bill/okleft.gif width=100 height=400 border=0></a><br><img src=bill/close.gif onClick="closeBanner();">'); 60
theFloaters.addItem('followDiv2',0,0,'<a onClick="closeBanner();" href=http://www.binhaistar.com target=_blank><img src=bill/okright.gif width=100 height=400 border=0 ></a><br><img src=bill/close.gif onClick="closeBanner();">'); 61
theFloaters.play();





}
}