js對聯廣告可關閉

來源:互聯網
上載者:User

<html>
<head>
<title>對聯廣告代碼</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body>
<table><tr><td height="1000"></tr></td></table>
<script language="網頁特效">
 var delta=0.8;
 var collection;
 var closeb=false;
 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()',30);
      }
  }
  function play()
  {
   if(screen.width<=800 || closeb)
   {
    for(var i=0;i<collection.length;i++)
    {
     collection[i].object.style.display = 'none';
    }
    return;
   }
   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.body.scrollleft+followobj_x)) {
     var dx=(document.body.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.body.scrolltop+followobj_y)) {
     var dy=(document.body.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 = '';
   }
  } 
  function closebanner()
  {
   closeb=true;
   return;
  }

 var thefloaters  = new floaters();
 thefloaters.additem('followdiv1','document.body.clientwidth-106',80,'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="97" height="233"><param name="movie" value="/jscss教程/demoimg/200908/ad-02.swf"><param name="quality" value="high"><embed src="/jscss/demoimg/200908/ad-02.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="97" height="233"></embed></object><br><br><img src="/jscss/demoimg/200908/close.gif" onclick="closebanner();">');
 thefloaters.additem('followdiv2',6,80,'<img src="/jscss/demoimg/dl.jpg" width="97" height="233"><br><br><img src="/jscss/demoimg/200908/close.gif" onclick="closebanner();">');
 thefloaters.play();
</script>
</p>
</body>
</html>

對聯廣告執行個體二

scroolad.js// javascript documentvar closebuttonhtml = '<div align="right" style="position: absolute;top:0px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:;" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;">關閉</a></div>'lastscrolly=0;function heartbeat(){ var diffy;if (document.documentelement && document.documentelement.scrolltop)diffy = document.documentelement.scrolltop;else if (document.body)diffy = document.body.scrolltopelse{/*netscape stuff*/}percent=.1*(diffy-lastscrolly); if(percent>0)percent=math.ceil(percent); else percent=math.floor(percent); document.getelementbyid("lovexin12").style.top=parseint(document.getelementbyid("lovexin12").style.top)+percent+"px";document.getelementbyid("lovexin14").style.top=parseint(document.getelementbyid("lovexin12").style.top)+percent+"px";lastscrolly=lastscrolly+percent; }suspendcode12="<div id="lovexin12" style='left:2px;position:absolute;top:120px;width:90px;height:230px;background-color:#ededed;border:1px solid #ddd;'>"+closebuttonhtml+"<img src="/images/bq100.gif"/></div>"suspendcode14="<div id="lovexin14" style='right:2px;position:absolute;top:120px;width:90px;height:230px;background-color:#ededed;border:1px solid #ddd;'>"+closebuttonhtml+"<img src="/images/bq100.gif"/></div>"document.write(suspendcode12); document.write(suspendcode14); window.setinterval("heartbeat()",1);function hidead(){ document.getelementbyid("lovexin12").style.display="none"; document.getelementbyid("lovexin14").style.display="none";}<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3c.org/tr/1999/rec-html401-19991224/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=gb2312" /><title>標準對聯廣告js代碼</title><style type="text/css"><!--html,body{height:1203px;}#mm{height:1000px;}--></style><script language="javascript" type="text/javascript" src="scroolad.js"></script></head><body><div id="mm"></div></body></html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.