Ad. js
Copy codeThe Code is as follows:
Var delta = 0.08.
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 [I]. object;
Var followObj_x = (typeof (collection [I]. x) = 'string '? Eval (collection [I]. x): collection [I]. x );
Var followObj_y = (typeof (collection [I]. y) = 'string '? Eval (collection [I]. y): collection [I]. 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 = '';
}
}
Var theFloaters = new floaters ();
// Right
TheFloaters. addItem ('followdiv1 ', 'document. body. clientWidth-106 ', 80, '<EMBED src = images/duilian.swf quality = high WIDTH = 100 HEIGHT = 300 TYPE = application/x-shockwave-flash id = ad wmode = opaque> </EMBED> ');
// Left
TheFloaters. addItem ('followdiv2', 6, 80, '<EMBED src = images/duilian.swf quality = high WIDTH = 100 HEIGHT = 300 TYPE = application/x-shockwave-flash id = ad wmode = opaque> </EMBED> ');
TheFloaters. play ();
// Image format call Method
// <A href = http://www.makewing.com/lanren/ target = _ blank> </a>