js左右弹性滚动对联广告代码分享

代码如下:

<p>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type" /><style type="text/css">

.shuoming {margin-top:20px; border:1px solid #ccc; padding-bottom:10px; width:600px; margin:0 auto;}
.shuoming dt {height:30px; line-height:30px; font-weight:bold; text-indent:10px;}
.shuoming dd {line-height:20px; padding:5px 20px;}</style></p>
<script language=JavaScript >
 var delta=0.08
 var collection;
 function floaters() {
  this.items = [];
  this.addItem = function(id,x,y,content)
      {
     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>');

var newItem    = {};
     newItem.object   = document.getElementById(id);
     newItem.x    = x;
     newItem.y    = y;

this.items[this.items.length]  = newItem;
      }
  this.play = function()
      {
     collection    = this.items
     setInterval('play()',10);
      }
  }
  function play()
  {

for(var i=0;i<collection.length;i++)
   {
    var followObj  = collection[i].object;
    var followObj_x  = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
    var followObj_y  = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);

if(followObj.offsetLeft!=(document.documentElement.scrollLeft+followObj_x)) {
     var dx=(document.documentElement.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
     dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
     followObj.style.left=followObj.offsetLeft+dx;
     }

if(followObj.offsetTop!=(document.documentElement.scrollTop+followObj_y)) {
     var dy=(document.documentElement.scrollTop+followObj_y-followObj.offsetTop)*delta;
     dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
     followObj.style.top=followObj.offsetTop+dy;
     }
    followObj.style.display = '';
   }
  }

var theFloaters  = new floaters();
 //右面
 theFloaters.addItem('followDiv1','document.documentElement.clientWidth-106',80,'<img src=http://pic.jb51.net/sudu.gif id=ad />');
 //左面
 theFloaters.addItem('followDiv2',6,80,'<img src=http://pic.jb51.net/sudu.gif id=ad />');
 theFloaters.play();

//图片格式调用方法
//<a href=http://www.jb51.net.net/ target=_blank><img  src=http://pic.jb51.net/sudu.gif border=0></a>

</script>
<table border="0" cellspacing="0" cellpadding="0" width="778" bgcolor="#f4f4f4" align="center" height="1500">
    <tbody>
        <tr>
            <td valign="top" align="center"><br />
            <dl class="shuoming"></dl></td>
        </tr>
    </tbody>
</table>

(0)

相关推荐

  • 弹出广告特效代码(一个IP只弹出一次)

    <script> var cookieString = new String(document.cookie) var cookieHeader = 'happy_pop=' //更换happy_pop为任意名称 var beginPosition = cookieString.indexOf(cookieHeader) if (beginPosition <0){ window.open('2.html','','top=0,left=0,width=787,height=480,to

  • JavaScript常用的弹出广告及背投广告实现方法

    本文实例讲述了JavaScript常用的弹出广告及背投广告实现方法.分享给大家供大家参考.具体分析如下: 弹出广告和背景广告在大网站用的比较多,也是站长的必备代码,本代码段中包括弹出窗口广告以及背投广告两种形式,根据自己的需要,你可以随意选择. 注:这类广告不建议大家用,大多浏览器都会把此类AD拦截,只为大家学习之用. 复制代码 代码如下: <html> <head> <title>JavaScript常用的弹出广告及背投广告代码</title> </

  • jquery右下角自动弹出可关闭的广告层

    右下角弹出层后,会在一定时间后自动隐藏. html代码: <!DOCTYPE HTML> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"> <title>jquery右下角自动弹出关闭层</title><base target="_blank"/> <scrip

  • emapicn.exe,winpac.exe恶意插件疯弹广告解决方法

    1.运行强制删除工具PowerRMV 下载地址:down.45it.com 分别复制下面的文件(包括完整的路径) ,勾选"清除,并抑止文件再次生成",点开始[有找不到提示的请忽略错误继续] d:\program files\common files\sevcha\emapicn.exe d:\program files\common files\sevcha\winpac.exe 2.删除重启后使用SREng(可到down.45it.com下载): 删除下面的服务(运行SRENG---

  • 基于jQuery的网页右下角弹出广告(IE7,firefox)

    演示代码: 测试 .divCss{ bottom:0; display:block; height:25px; overflow:hidden; padding:0; position:fixed; right:20px; } .contentCss{ background:#666; height:200px; width:200px; } .contentCssHeight{ } .titleCss{ width:200px; height:25px; line-height:25px; t

  • JavaScript定时器制作弹窗小广告

    本文实例为大家分享了js定时器制作弹窗广告的具体代码,供大家参考,具体内容如下 <head> <meta charset="UTF-8"> <title>Title</title> <style type="text/css"> * { padding: 0; margin: 0; } li { list-style: none; } body { background: #940032; } #count

  • js退弹 IE关闭时弹出广告代码,可以防止屏蔽

    在网上寻觅了很久JS退弹代码,也没有找出让人非常满意的代码.于是今天把收集的退弹代码做了一下整理,精简出一个非常短小精悍而强力的JS退弹代码,能够突破现在绝大多数浏览器的限制,包括SP2.IE6.IE7.遨游.MYIE等等. 现提供给有这方面需求的用户: 完整版24小时只弹一次的代码 复制代码 代码如下: function Get(){ var Then = new Date() Then.setTime(Then.getTime() + 24*60*60*1000) //这里是24小时,如果想

  • 弹出广告特效(一个IP只弹出一次)的代码

    <script> var cookieString = new String(document.cookie) var cookieHeader = 'happy_pop=' //更换happy_pop为任意名称 var beginPosition = cookieString.indexOf(cookieHeader) if (beginPosition <0){ window.open('2.html','','top=0,left=0,width=787,height=480,to

  • 仿中关村在线首页弹出式广告插件(jQuery版)

    其的就不多说啦,直接上代码: jquery 插件: 复制代码 代码如下: /* 疯狂秀才 制作 于 2012-04-24 17:00 QQ: 1055818239 email: hxl_apple@163.com */ (function($){ $.fn.quickAd = function(settings){ settings = $.extend({ width:760, height:400, html:'我是广告内容', top:130, sec:5, //广告显示时长,单位秒 bo

  • JS实现弹性漂浮效果的广告代码

    本文实例讲述了JS实现弹性漂浮效果的广告代码.分享给大家供大家参考.具体如下: 这里介绍一款JS弹性漂浮广告代码,碰到网页浏览器的边缘就会顺着弹力的方向自动漂浮下去,不停的在网页上漂来漂去,漂浮广告代码是很早时候就有的代码了,使用广泛,而且做为广告来说,好像效果还不错,因为它在不停的动,让人在视觉上感觉到有一种吸引力.其中的JS代码你可以扣出来保存在一个单独的JS文件中,使用时调用即可. 运行效果截图如下: 在线演示地址如下: http://demo.jb51.net/js/2015/js-mo

随机推荐