您现在的位置: 365建站网 > 365文章 > js右下角弹出广告代码

js右下角弹出广告代码

文章来源:365jz.com     点击数:358    更新时间:2018-10-14 20:05   参与评论

 js右下角弹出广告代码1:

</>code

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
  5. <title>js右下角弹出广告代码</title> 
  6. </head> 
  7. <style type="text/css"> 
  8. #rbbox{position:absolute;right:0;bottom:0;width:300px;height:0px;overflow:hidden} 
  9. .button{display:inline;float:right;font-size:12px;cursor:pointer} 
  10. </style> 
  11. <body><div id="rbbox"><a class="button" onclick="closeBox()">关闭</a><iframe src="https://www.365jz.com" frameborder="0" height="200" width="300" scrolling="no"></iframe></div> 
  12. </body> 
  13. </html> 
  14. <script language="javascript" type="text/javascript"> 
  15. window.onload=function(){showBox();setTimeout("closeBox()",5000)} 
  16. function showBox(o){ 
  17. if (o==undefined) o=document.getElementById("rbbox"); 
  18. o.style.height=o.clientHeight+2+"px"; 
  19. if (o.clientHeight<200) setTimeout(function(){showBox(o)},5); 
  20. function closeBox(){document.getElementById("rbbox").style.display="none";} 
  21. </script>


 js右下角弹出广告代码2:

</>code

  1. <!DOCTYPE html PUBLIC "-//W3C//h2D XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/h2D/xhtml1-transitional.h2d">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <style>
  7. * { padding: 0; margin: 0; }
  8. li { list-style: none; }
  9. body { background: #eee; }
  10. .float_layer { width: 300px; border: 1px solid #aaaaaa; display:none; background: #fff; }
  11. .float_layer h2 { height: 25px; line-height: 25px; padding-left: 10px; font-size: 14px; color: #333; background: url(/daima/68/images/title_bg.gif) repeat-x; border-bottom: 1px solid #aaaaaa; position: relative; }
  12. .float_layer .min { width: 21px; height: 20px; background: url(images/min.gif) no-repeat 0 bottom; position: absolute; top: 2px; right: 25px; }
  13. .float_layer .min:hover { background: url(/daima/68/images/min.gif) no-repeat 0 0; }
  14. .float_layer .max { width: 21px; height: 20px; background: url(images/max.gif) no-repeat 0 bottom; position: absolute; top: 2px; right: 25px; }
  15. .float_layer .max:hover { background: url(/daima/68/images/max.gif) no-repeat 0 0; }
  16. .float_layer .close { width: 21px; height: 20px; background: url(/daima/68/images/close.gif) no-repeat 0 bottom; position: absolute; top: 2px; right: 3px; }
  17. .float_layer .close:hover { background: url(/daima/68/images/close.gif) no-repeat 0 0; }
  18. .float_layer .content { height: 160px; overflow: hidden; font-size: 14px; line-height: 18px; color: #666; text-indent: 28px; }
  19. .float_layer .wrap { padding: 10px; }
  20. </style>
  21. <script type="text/javascript">
  22. function miaovAddEvent(oEle, sEventName, fnHandler)
  23. {
  24.  if(oEle.attachEvent)
  25.  {
  26.   oEle.attachEvent('on'+sEventName, fnHandler);
  27.  }
  28.  else
  29.  {
  30.   oEle.addEventListener(sEventName, fnHandler, false);
  31.  }
  32. }
  33. window.onload = function()
  34. {
  35.  var oDiv=document.getElementById('miaov_float_layer');
  36.  var oBtnMin=document.getElementById('btn_min');
  37.  var oBtnClose=document.getElementById('btn_close');
  38.  var oDivContent=oDiv.getElementsByTagName('div')[0];
  39.  var iMaxHeight=0;
  40.  var isIE6=window.navigator.userAgent.match(/MSIE 6/ig) && !window.navigator.userAgent.match(/MSIE 7|8/ig);
  41.  oDiv.style.display='block';
  42.  iMaxHeight=oDivContent.offsetHeight;
  43.  if(isIE6)
  44.  {
  45.   oDiv.style.position='absolute';
  46.   repositionAbsolute();
  47.   miaovAddEvent(window, 'scroll', repositionAbsolute);
  48.   miaovAddEvent(window, 'resize', repositionAbsolute);
  49.  }
  50.  else
  51.  {
  52.   oDiv.style.position='fixed';
  53.   repositionFixed();
  54.   miaovAddEvent(window, 'resize', repositionFixed);
  55.  }
  56.  oBtnMin.timer=null;
  57.  oBtnMin.isMax=true;
  58.  oBtnMin.onclick=function ()
  59.  {
  60.   startMove
  61.   (
  62.    oDivContent, (this.isMax=!this.isMax)?iMaxHeight:0,
  63.    function ()
  64.    {
  65.     oBtnMin.className=oBtnMin.className=='min'?'max':'min';
  66.    }
  67.   );
  68.  };
  69.  oBtnClose.onclick=function ()
  70.  {
  71.   oDiv.style.display='none';
  72.  };
  73. };
  74. function startMove(obj, iTarget, fnCallBackEnd)
  75. {
  76.  if(obj.timer)
  77.  {
  78.   clearInterval(obj.timer);
  79.  }
  80.  obj.timer=setInterval
  81.  (
  82.   function ()
  83.   {
  84.    doMove(obj, iTarget, fnCallBackEnd);
  85.   },30
  86.  );
  87. }
  88. function doMove(obj, iTarget, fnCallBackEnd)
  89. {
  90.  var iSpeed=(iTarget-obj.offsetHeight)/8;
  91.  if(obj.offsetHeight==iTarget)
  92.  {
  93.   clearInterval(obj.timer);
  94.   obj.timer=null;
  95.   if(fnCallBackEnd)
  96.   {
  97.    fnCallBackEnd();
  98.   }
  99.  }
  100.  else
  101.  {
  102.   iSpeed=iSpeed>0?Math.ceil(iSpeed):Math.floor(iSpeed);
  103.   obj.style.height=obj.offsetHeight+iSpeed+'px';
  104.   ((window.navigator.userAgent.match(/MSIE 6/ig) && window.navigator.userAgent.match(/MSIE 6/ig).length==2)?repositionAbsolute:repositionFixed)()
  105.  }
  106. }
  107. function repositionAbsolute()
  108. {
  109.  var oDiv=document.getElementById('miaov_float_layer');
  110.  var left=document.body.scrollLeft||document.documentElement.scrollLeft;
  111.  var top=document.body.scrollTop||document.documentElement.scrollTop;
  112.  var width=document.documentElement.clientWidth;
  113.  var height=document.documentElement.clientHeight;
  114.  oDiv.style.left=left+width-oDiv.offsetWidth+'px';
  115.  oDiv.style.top=top+height-oDiv.offsetHeight+'px';
  116. }
  117. function repositionFixed()
  118. {
  119.  var oDiv=document.getElementById('miaov_float_layer');
  120.  var width=document.documentElement.clientWidth;
  121.  var height=document.documentElement.clientHeight;
  122.  oDiv.style.left=width-oDiv.offsetWidth+'px';
  123.  oDiv.style.top=height-oDiv.offsetHeight+'px';
  124. }
  125. </script>
  126. </head>
  127. <body style="height: 2200px">
  128. <div class="float_layer" id="miaov_float_layer">
  129.  <h2>
  130.  <strong>这是标题</strong>
  131.  <a id="btn_min" href="javascript:;" class="min"></a>
  132.  <a id="btn_close" href="javascript:;" class="close"></a>
  133.  </h2>
  134.  <div class="content">
  135.   <div class="wrap">
  136.   这里放置的是广告信息,你可以填入任何的广告内容,比如像这样:<strong>365建站网提供企业/公司免费建站、快速批量建站、快速建站、智能建站软件系统等网站建设服务和seo工具,让建站和SEO变得简单!</strong>
  137.  </div>
  138.  </div>
  139. </div>
  140. </body>
  141. </html>


如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛

发表评论 (358人查看0条评论)
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
昵称:
最新评论
------分隔线----------------------------

快速入口

· 365软件
· 杰创官网
· 建站工具
· 网站大全

其它栏目

· 建站教程
· 365学习

业务咨询

· 技术支持
· 服务时间:9:00-18:00
365建站网二维码

Powered by 365建站网 RSS地图 HTML地图

copyright © 2013-2024 版权所有 鄂ICP备17013400号