Chinaunix首页 | 论坛 | 博客
  • 博客访问: 337979
  • 博文数量: 71
  • 博客积分: 2129
  • 博客等级: 大尉
  • 技术积分: 835
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-18 16:03
文章分类

全部博文(71)

文章存档

2014年(22)

2013年(18)

2012年(24)

2010年(7)

我的朋友

分类: JavaScript

2013-04-19 10:39:23

今天分享一个javascript实现仿QQ右下浮出式的广告窗口JS代码。

效果不错,支持多种浏览器,大家直接粘贴着用就可以。希望对大家闺秀有所帮助,后继会更新我的相关深井泵经验分享,请多多关注!呵呵---

代码如下:

01
02
03
04 仿QQ右下浮出式的广告窗口JS代码 - 编程博客()
05
06
07
08 window.onload = enetgetMsg;
09 window.onresize = enetresizeDiv;
10 window.onerror = function(){}
11 var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight;
12 var enetdocHeight,enetdocWidth,enetobjTimer,i = 0;
13 function enetgetMsg()
14 {
15 try{
16 enetdivTop = parseInt(document.getElementById("ykmaiz.com").style.top,10)
17 enetdivLeft = parseInt(document.getElementById("ykmaiz.com").style.left,10)
18 enetdivHeight = parseInt(document.getElementById("ykmaiz.com").offsetHeight,10)
19 enetdivWidth = parseInt(document.getElementById("ykmaiz.com").offsetWidth,10)
20 enetdocWidth = document.body.clientWidth;
21 enetdocHeight = document.body.clientHeight;
22 document.getElementById("ykmaiz.com").style.top = parseInt(document.body.scrollTop,10) + enetdocHeight + 10;// enetdivHeight
23 document.getElementById("ykmaiz.com").style.left = parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth
24 document.getElementById("ykmaiz.com").style.visibility="visible"
25 enetobjTimer = window.setInterval("enetmoveDiv()",10)
26 }
27 catch(e){}
28 }
29
30 function enetresizeDiv()
31 {
32 i+=1
33 if(i>800) enetcloseDiv() /自动关闭时间
34 try{
35 enetdivHeight = parseInt(document.getElementById("ykmaiz.com").offsetHeight,10)
36 enetdivWidth = parseInt(document.getElementById("ykmaiz.com").offsetWidth,10)
37 enetdocWidth = document.body.clientWidth;
38 enetdocHeight = document.body.clientHeight;
39 document.getElementById("ykmaiz.com").style.top = enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)
40 document.getElementById("ykmaiz.com").style.left = enetdocWidth - enetdivWidth + parseInt(document.body.scrollLeft,10)
41 }
42 catch(e){}
43 }
44 function enetmoveDiv()
45 {
46 try
47 {
48 if(parseInt(document.getElementById("ykmaiz.com").style.top,10) <= (enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)))
49 {
50 window.clearInterval(enetobjTimer)
51 enetobjTimer = window.setInterval("enetresizeDiv()",1)
52 }
53 enetdivTop = parseInt(document.getElementById("ykmaiz.com").style.top,10)
54 document.getElementById("ykmaiz.com").style.top = enetdivTop - 1
55 }
56 catch(e){}
57 }
58 function enetcloseDiv()
59 {
60 document.getElementById('ykmaiz.com').style.visibility='hidden';
61 if(enetobjTimer) window.clearInterval(enetobjTimer)
62 }
63
64
65 style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; VISIBILITY: visible; BORDER-LEFT: #a6b4cf 1px solid; 1px solid; POSITION: absolute; TOP: -256px; HEIGHT: 157px">
66 http://www.ykmaiz.com/images/logob3.gif"border="0">
67
68
69


深井泵产品相关性信息量:
阅读(995) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~