| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3032 人关注过本帖
标题:[转帖]网页特效,,实现对联广告三种方法
只看楼主 加入收藏
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
结帖率:77.27%
收藏
 问题点数:0 回复次数:13 
[转帖]网页特效,,实现对联广告三种方法

var delta=0.015 var collection; function floaters() { this.items = []; this.addItem = function(id,x,y,content) { document.write('<DIV id='+id+' style="Z-INDEX: 0; 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() { if(screen.width<=800) { for(var i=0;i<collection.length;i++) { collection[i].object.style.display = 'none'; } return; } 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-100',0,'</a><br><a href=广告链接地址 target=_blank><img src=广告图片地址 width=100 height=400 border=0></a>'); theFloaters.addItem('followDiv2',0,0,'<br><a href=广告链接地址 target=_blank><img src=广告图片地址 width=100 height=400 border=0></a>'); theFloaters.play();

把上面的代码另存为一个JS文件,然后在想实现此效果的页面用<script type="text/javascript" language="javascript1.2" src="*.js"></SCRIPT>调用即可,*代表你另存的文件名!注意修改广告图片地址和连接地址!

这是其中一个,还有两个,我过些时候才传,,,,,
搜索更多相关主题的帖子: 网页特效 广告 对联 转帖 var 
2004-11-25 08:34
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
收藏
得分:0 

var delta=0.015; var collection; var closeB=false; 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()',30); } } function play() { if(screen.width<=800 || closeB) { for(var i=0;i<collection.length;i++) { collection[i].object.style.display = 'none'; } return; } 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 = ''; } } function closeBanner() { closeB=true; return; }

var theFloaters = new floaters(); // theFloaters.addItem('followDiv1','document.body.clientWidth-100',0,'<a onClick="closeBanner();" href=http://www.dfeng.net target=_blank><img src=ad/doublead/right.gif width=100 height=554 border=0></a><br><br><img src=ad/doublead/close.gif onClick="closeBanner();">'); theFloaters.addItem('followDiv2',0,0,'<a onClick="closeBanner();" href=http://www.dfeng.net target=_blank><img src=ad/doublead/ad_ad.gif width=100 height=400 border=0 ></a><br><br><img src=ad/doublead/close.gif onClick="closeBanner();">'); theFloaters.play();


面朝大海,春暖花开!
2004-11-25 08:40
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 
这个东西最好发到JS版。

天津网站建设 http://www./
2004-11-25 08:59
regedit
Rank: 5Rank: 5
等 级:贵宾
威 望:19
帖 子:950
专家分:0
注 册:2004-6-8
收藏
得分:0 

不过好象还不错~


最新作品:百货品牌商品资讯第一门户([url]http://www./[/url]),欢迎交流
2004-11-25 10:15
regedit
Rank: 5Rank: 5
等 级:贵宾
威 望:19
帖 子:950
专家分:0
注 册:2004-6-8
收藏
得分:0 
[转帖]网页特效,,实现对联广告三种方法
我帮你拉到JS区吧~

最新作品:百货品牌商品资讯第一门户([url]http://www./[/url]),欢迎交流
2004-11-25 10:15
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
收藏
得分:0 
顶一下下嘛,,呵呵,,,

面朝大海,春暖花开!
2004-11-27 13:11
malwater
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2004-12-11
收藏
得分:0 

菜鸟何时成老鸟? 十年苦学几时笑? 专心学E好多年! 菜鸟总会变老鸟~
2004-12-11 20:39
寒冰石
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2004-12-10
收藏
得分:0 
看了头晕,顶不了

我的主页http://cice.
2004-12-12 17:04
huangjin
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2005-1-20
收藏
得分:0 
对于初学者看了确实头大啊,
不过直接调用倒还可以的,
不有“研究”
呵呵
2005-01-20 12:12
huangjin
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2005-1-20
收藏
得分:0 
最新消息啊!!!对联里不能放入.swf文件啊,这是为什么啊?
2005-01-31 10:03
快速回复:[转帖]网页特效,,实现对联广告三种方法
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016166 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved