左右漂浮的广告代码
2004-11-30 16:47
423 查看
引用JS文件的代码:
<script language="javascript" src="****.js"></script>
<----
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[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();
theFloaters.addItem('followDiv1','document.body.clientWidth-112',230,'<a href=http://www.***.com/ target=_blank><img src=***.gif border=0></a>');
theFloaters.addItem('followDiv2',12,230,'<a href=http://www.***.com/ target=_blank><img src=***.gif border=0></a>');
theFloaters.play();
-->
<script language="javascript" src="****.js"></script>
<----
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[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();
theFloaters.addItem('followDiv1','document.body.clientWidth-112',230,'<a href=http://www.***.com/ target=_blank><img src=***.gif border=0></a>');
theFloaters.addItem('followDiv2',12,230,'<a href=http://www.***.com/ target=_blank><img src=***.gif border=0></a>');
theFloaters.play();
-->
相关文章推荐
- 翻译的PureFTPd配置文件
- Delphi 7 中使用RAVE报表(一)
- java学习笔记6--Reusing classes
- SmartUpload与ftp两种上传方式的合并
- Expression Evaluator
- Delphi2005学习笔记1
- NOV/30/2004
- 请问在.net framework精简版,使用C#语言如何实现MD5和SHA1算法
- delphi修改电脑IP
- iBatis指南、Hibernate指南、Spring开发指南
- Delphi控制Excel
- 一个数据连接例子c#
- 动态数组介绍----Delphi
- 玩Google有妙法:使用技巧十九招(转自计世网)
- 需要在近期内澄清的概念以及需要掌握的方法
- SQL注入天书—ASP注入漏洞全接触
- Delphi 2005将把Borland带入死亡!!
- [ASP.NET]System.UnauthorizedAccessException: 拒绝访问。
- [ASP.NET]System.UnauthorizedAccessException: 拒绝访问。
- boiz 的 C++ 备忘录(一)