首  页  |  酷站  |  精品网站  |  原创作品秀  |  网络学院   |  信息中心  |  艺术设计  |  求职招聘  |  建站资源  |  服装网站  |  论坛  |  设计部落  |  网站综合
个人网页  商业网站  业界动态  设计赛事  网站资源  下载专区  设计欣赏  CG-插画  JS特效  娱乐  国际品牌  知名品牌  服装院校  专题欣赏  SEO  BANNER
域名注册 虚拟主机 广州网站建设 广州网页设计 IDC赞助 设计资源下载 虚拟主机 域名注册 品牌网站建设 服装品牌网站建设 广告服务 网站推广 娱乐
当前位置:首 页 >> JS特效 >> 页面特效类 >> 网页左右上下浮动广告代码制作

网页左右上下浮动广告代码制作


中资源
转载请注明出处-中国设计秀-cnwebshow.com

1、在网页中加入 <script language=javascript src="js/1.js"></script> 表示调用当前目录下的js目录下的t.js 2、用记事本建立1.js 并保存到js目录下 并把后缀名从txt改名为js   w4:C63)  
t.js内容如下    $QZ ZEr  
zU-Vpg~XL  
var delta=0.15 nvOV-`W2+s  
var collection; XE2,pjZ  
function floaters() { !2:B71@D  
this.items = []; iZ,6ntT  
this.addItem = function(id,x,y,content) V|*DkS $&  
{ " $e,#6i  
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>'); okxi `M $A  
 ] "  
var newItem = {}; ~Wg>H>/[  
newItem.object = document.getElementById(id); Lg :/9b*  
newItem.x = x; 2%D^>`  
newItem.y = y; O&e}lvJ  
#E`iFGJ6d2  
this.items[this.items.length] = newItem; uAT9go  
} FQ'Fv/cS/  
this.play = function() A2NgOr_  
{ Q dc:ft?  
collection = this.items Og|&'  
setInterval('play()',10); %Cx9T(  
} t&Xgt8*  
} 6[wbk uc  
function play() +K|dzu(lr  
{ fSP7l6  
Fp_#N}  
for(var i=0;i<collection.length;i++) <l1 -T-  
{ iY`k,9h5  
var followObj = collection.object; cx VIV_K,  
var followObj_x = (typeof(collection.x)=='string'?eval(collection.x):collection.x); YBKv2s{~&*  
var followObj_y = (typeof(collection.y)=='string'?eval(collection.y):collection.y); h7] {6pc3  
H+La7b69  
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) { } $~mXd)mT  
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta; x)Q|ye ?@2  
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx)); Vvz<RPn(R  
followObj.style.left=followObj.offsetLeft+dx; &rS2#dW  
} P#KR:W  
ldIq%>vG  
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) { O:`c{M8  
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta; U;W( ;( &  
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy)); =o`n=  
followObj.style.top=followObj.offsetTop+dy; Eu|M95 -  
} L} oP L  
followObj.style.display = ''; H<hVsVF  
} W>/C-nO  
} FC{OeBr+  
waFW^  
var theFloaters = new floaters(); 4w:EVCB*5  
theFloaters.addItem('followDiv1','document.body.clientWidth-110',230,'<a href=http://www.cfanclub.net target=_blank><img src=ad/ad001.gif border=0></a><br><br>'); -2^{I>4jH  
theFloaters.addItem('followDiv2',12,230,'<a href=http://bbs.cfanclub.net target=_blank><img src=ad/ad002.gif border=0></a><br><br>'); @yjw[j1  
theFloaters.play(); 8^MV0upE  
uhDDVFFo  
其中红色用所做广告地址代替 蓝色用所需要的广告图片地址代替
转载请注明出处-中国设计秀-cnwebshow.com



投稿 】【对本文进行评论】 【字体: 】【发布于2006-06-09 11:01】

相关专题:暂无相关专题

上一篇:JavaScript实现页面淡出效果   下一篇:页面内的超级酷浮动窗口
 认证LOGO下载
     
Copyright © 2005-2007 中国设计秀_网页设计教程_优秀网页设计欣赏_平面设计欣赏 All Right Reserved.
做最专业的设计服务网站,秀出自我,秀出精彩!中国设计秀,秀---无处不在!!
QQ:54292427  8208442 MSN:kingvisual#hotmail.com 交流群:9107036 3848215 8850631
粤ICP备05067046号 RSS