码迷,mamicode.com
首页 > 其他好文 > 详细

两侧浮动广告代码

时间:2015-01-08 17:23:21      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:


两侧浮动广告代码


SCRIPT language=JavaScript src=menus.js
Script
DIV id=floater1 style=Z-INDEX 100; LEFT 10px; VISIBILITY visible; WIDTH 100px; POSITION absolute; TOP 160px; height 100px; 
左边的东西,可以是图片,表格,可以设置其宽,高
DIV 
DIV id=floater style=Z-INDEX 100; RIGHT 10px; VISIBILITY visible; WIDTH 100px; POSITION absolute; TOP 160px; left 890px; 
右边的东西,可以是图片,表格,可以设置其宽高
DIV 
menus.js
self.onError = null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers)  1  0;
IE = (document.all)  1 0;
function heartBeat(objectid) {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1  (diffY - lastScrollY);
if(percent  0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) {
objectid = objectid.split(;);
for (i = 0; i  objectid.length; i++) eval(document.all.+objectid).style.pixelTop += percent;
}
if(NS) {
objectid = objectid.split(;);
for (i = 0; i  objectid.length; i++) eval(document.+objectid).top += percent;
}
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1  (diffX - lastScrollX);
if(percent  0) percent = Math.ceil(percent);JS代码
else percent = Math.floor(percent);
if(IE) {
objectid = objectid.split(;);
for (i = 0; i  objectid.length; i++) eval(document.all.+objectid).style.pixelLeft += percent;
}
if(NS) {
objectid = objectid.split(;);
for (i = 0; i  objectid.length; i++) eval(document.+objectid).left += percent;   
}
lastScrollX = lastScrollX + percent;

}
if(NS  IE) action = window.setInterval(heartBeat(‘floater;floater1‘), 2);


下载地址:http://www.huiyi8.com/guanggaodaima/fudong/(转载请注明此处)

两侧浮动广告代码

标签:

原文地址:http://www.cnblogs.com/lhrs/p/4211024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!