网页两侧浮动广告
1<!--对联开始 -->
2<script>
3var delta=0.015;
4 var collection;
5 var closeB=false;
6 function floaters() {
7 this.items = [];
8 this.addItem = function(id,x,y,content)
9 {
10 document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:105px; height:225px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
11
12 var newItem = {};
13 newItem.object = document.getElementById(id);
14 newItem.x = x;
15 newItem.y = y;
16
17 this.items[this.items.length] = newItem;
18 }
19 this.play = function()
20 {
21 collection = this.items
22 setInterval('play()',1);
23 }
24 }
25 function play()
26 {
27 if(screen.width<=800 || closeB)
28 {
29 for(var i=0;i<collection.length;i++)
30 {
31 collection[i].object.style.display = 'none';
32 }
33 return;
34 }
35 for(var i=0;i<collection.length;i++)
36 {
37 var followObj = collection[i].object;
38 var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
39 var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
40
41 if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
42 var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
43 dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
44 followObj.style.left=followObj.offsetLeft+dx;
45 }
46
47 if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
48 var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
49 dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
50 followObj.style.top=followObj.offsetTop+dy;
51 }
52 followObj.style.display = '';
53 }
54 }
55 function closeBanner()
56 {
57 closeB=true;
58 return;
59 }
60
61 var theFloaters = new floaters();
62 //
63 theFloaters.addItem('followDiv1','document.body.clientWidth-100',80,'<a href=#><img src="imgs/nanjzgs.gif" border="0" width="110" height="374"></a>');
64 theFloaters.addItem('followDiv2',4,80,'<a href=#><img src="imgs/nanjzgs.gif" border="0" width="110" height="374"></a>');
65
66 theFloaters.play();
67
68</script>
69
70<!--对联结束-->
71
1<!--对联开始 -->
2<script>
3var delta=0.015;
4 var collection;
5 var closeB=false;
6 function floaters() {
7 this.items = [];
8 this.addItem = function(id,x,y,content)
9 {
10 document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:105px; height:225px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
11
12 var newItem = {};
13 newItem.object = document.getElementById(id);
14 newItem.x = x;
15 newItem.y = y;
16
17 this.items[this.items.length] = newItem;
18 }
19 this.play = function()
20 {
21 collection = this.items
22 setInterval('play()',1);
23 }
24 }
25 function play()
26 {
27 if(screen.width<=800 || closeB)
28 {
29 for(var i=0;i<collection.length;i++)
30 {
31 collection[i].object.style.display = 'none';
32 }
33 return;
34 }
35 for(var i=0;i<collection.length;i++)
36 {
37 var followObj = collection[i].object;
38 var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
39 var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
40
41 if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
42 var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
43 dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
44 followObj.style.left=followObj.offsetLeft+dx;
45 }
46
47 if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
48 var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
49 dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
50 followObj.style.top=followObj.offsetTop+dy;
51 }
52 followObj.style.display = '';
53 }
54 }
55 function closeBanner()
56 {
57 closeB=true;
58 return;
59 }
60
61 var theFloaters = new floaters();
62 //
63 theFloaters.addItem('followDiv1','document.body.clientWidth-100',80,'<a href=#><img src="imgs/nanjzgs.gif" border="0" width="110" height="374"></a>');
64 theFloaters.addItem('followDiv2',4,80,'<a href=#><img src="imgs/nanjzgs.gif" border="0" width="110" height="374"></a>');
65
66 theFloaters.play();
67
68</script>
69
70<!--对联结束-->
71