非主流热门点击
非主流相关内容
搜索BLOG文章

看看你的文章有没有被百度收入

最新评论
博客基本信息
用户名: hsun3000
等级: 博士
在线时间: 25333 分钟
日志总数: 1289
评论数量: 188
访问次数: 589581
建立时间: 2007-03-02

XML RSS 2.0 WAP
我的日志
[免费代码]一个不错的网站对联广告JS代码2007-09-15

<html>
<head>
<title>浮动广告</title>
</head>
<body>
<Script Language="
javascript">
//左边
var left_img='<div>asdfasdf</div>';

//右边
var right_img='<div>asdfasdf</div>';
var delta=0.05
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 1000; POSITION: absolute; width:80px; height:4=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 = '';
}
}

var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',10,''+right_img+'');
theFloaters.addItem('followDiv2',5,10,''+left_img+'');
theFloaters.play();
</script>
</body>
</html>


原创文章如转载,请注明:转载自QQ非主流诱舞坊 [ http://hsun3000.blog.zj.com/ ]
本文链接地址:http://hsun3000.blog.zj.com/blog/d-155501.html

TAG: 对联
相关文章
文章评论0条回复
给文章评分
评分: -5 -3 -1 - +1 +3 +5
我来说两句
认证码*   看不清,就点我! 输入四位字母或数字
(您还没有登录,登录发表)
粗体 斜体 下划线 插入url链接 飞行字 移动字