兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx

上传人:啊飒飒 文档编号:11619680 上传时间:2021-08-26 格式:DOCX 页数:8 大小:12.93KB
返回 下载 相关 举报
兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx_第1页
第1页 / 共8页
兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx_第2页
第2页 / 共8页
兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx_第3页
第3页 / 共8页
兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx_第4页
第4页 / 共8页
兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx_第5页
第5页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx》由会员分享,可在线阅读,更多相关《兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码__1.docx(8页珍藏版)》请在三一文库上搜索。

1、兼容各大扫瞄器带关闭按钮的漂移多组图片广告代码_ js部分: 代码如下: script type=text/javascript language=javascript function addevent(obj, evttype, func, cap) cap = cap | false; if (obj.addeventlistener) obj.addeventlistener(evttype, func, cap); return true; else if (obj.attachevent) if (cap) obj.setcapture(); return true; else r

2、eturn obj.attachevent(on + evttype, func); else return false; function getpagescroll() var xscroll, yscroll; if (self.pagexoffset) xscroll = self.pagexoffset; else if (document.documentelement document.documentelement.scrollleft) xscroll = document.documentelement.scrollleft; else if (document.body)

3、 xscroll = document.body.scrollleft; if (self.pageyoffset) yscroll = self.pageyoffset; else if (document.documentelement document.documentelement.scrolltop) yscroll = document.documentelement.scrolltop; else if (document.body) yscroll = document.body.scrolltop; arraypagescroll = new array(xscroll, y

4、scroll); return arraypagescroll; function getpagesize() var xscroll, yscroll; if (window.innerheight window.scrollmaxy) xscroll = document.body.scrollwidth; yscroll = window.innerheight + window.scrollmaxy; else if (document.body.scrollheight document.body.offsetheight) xscroll = document.body.scrol

5、lwidth; yscroll = document.body.scrollheight; else xscroll = document.body.offsetwidth; yscroll = document.body.offsetheight; var windowwidth, windowheight; if (self.innerheight) windowwidth = self.innerwidth; windowheight = self.innerheight; else if (document.documentelement document.documentelemen

6、t.clientheight) windowwidth = document.documentelement.clientwidth; windowheight = document.documentelement.clientheight; else if (document.body) windowwidth = document.body.clientwidth; windowheight = document.body.clientheight; if (yscroll windowheight) pageheight = windowheight; else pageheight =

7、 yscroll; if (xscroll windowwidth) pagewidth = windowwidth; else pagewidth = xscroll; arraypagesize = new array(pagewidth, pageheight, windowwidth, windowheight) return arraypagesize; var admoveconfig = new object(); admoveconfig.isinitialized = false; admoveconfig.scrollx = 0; admoveconfig.scrolly

8、= 0; admoveconfig.movewidth = 0; admoveconfig.moveheight = 0; admoveconfig.resize = function () var winsize = getpagesize(); admoveconfig.movewidth = winsize2; admoveconfig.moveheight = winsize3; admoveconfig.scroll(); admoveconfig.scroll = function () var winscroll = getpagescroll(); admoveconfig.s

9、crollx = winscroll0; admoveconfig.scrolly = winscroll1; addevent(window, resize, admoveconfig.resize); addevent(window, scroll, admoveconfig.scroll); function admove(id) if (!admoveconfig.isinitialized) admoveconfig.resize(); admoveconfig.isinitialized = true; var obj = document.getelementbyid(id);

10、obj.style.position = absolute; var w = admoveconfig.movewidth - obj.offsetwidth; var h = admoveconfig.moveheight - obj.offsetheight; var x = w * math.random(), y = h * math.random(); var rad = (math.random() + 1) * math.pi / 6; var kx = math.sin(rad), ky = math.cos(rad); var dirx = (math.random() 0.

11、5 ? 1 : -1), diry = (math.random() 0.5 ? 1 : -1); var step = 1; var interval; this.setlocation = function (, vy) x = ; y = vy; this.setdirection = function (, vy) dirx = ; diry = vy; obj.custommethod = function () obj.style.left = (x + admoveconfig.scrollx) + px; obj.style.top = (y + admoveconfig.sc

12、rolly) + px; rad = (math.random() + 1) * math.pi / 6; w = admoveconfig.movewidth - obj.offsetwidth; h = admoveconfig.moveheight - obj.offsetheight; x = x + step * kx * dirx; if (x 0) dirx = 1; x = 0; kx = math.sin(rad); ky = math.cos(rad); if (x w) dirx = -1; x = w; kx = math.sin(rad); ky = math.cos

13、(rad); y = y + step * ky * diry; if (y 0) diry = 1; y = 0; kx = math.sin(rad); ky = math.cos(rad); if (y h) diry = -1; y = h; kx = math.sin(rad); ky = math.cos(rad); this.run = function () var delay = 10; interval = setinterval(obj.custommethod, delay); obj.onmouseover = function () clearinterval(in

14、terval); obj.onmouseout = function () interval = setinterval(obj.custommethod, delay); /script script type=text/javascript language=javascript var ad2 = new admove(ad2); ad2.run(); /多组漂移 /script html部分: 代码如下: div id=ad2 style=z-index: 5;position:relativea href=policehtk.aspx target=_blankimg src=images/fudong/fudong.jpg width=230 height=150 border=0 /abr a href=# onclick=document.getelementbyid(ad2).style.display=none img border=0 src=images/fudong/close1.gif /a /div 更多信息请查看IT技术专栏 .

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1