找回密码
 注册
查看: 1964|回复: 2

[分享] GG的对联广告做法代码带关闭按钮

  [复制链接]
发表于 2010-10-23 10:07:41 | 显示全部楼层 |阅读模式
GG的对联广告做法代码带关闭按钮

  1. 1、首先做2个htm网页,内容如下
  2. 1.left网页:
  3. <body style="background-color:transparent; TEXT-DECORATION:none; margin-left:0px; margin-top:0px;">
  4. <table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
  5.   <tr>
  6.     <td align="center" valign="bottom"><a href="#"onClick="parent.duilianad.style.display='none'">
  7. <font color="#31D7F7" size="2" style="TEXT-DECORATION: none;">【关闭广告】</font></a></td>
  8.   </tr>
  9. </table>
  10. <table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
  11.   <tr>
  12.     <td align="center" bgcolor="#000000">
  13. <script type="text/javascript"><!--
  14. google_ad_client = "pub-7687765725679397";
  15. google_ad_width = 120;
  16. google_ad_height = 600;
  17. google_ad_format = "120x600_as";
  18. google_ad_type = "image";
  19. google_ad_channel = "";
  20. google_color_border = "336699";
  21. google_color_bg = "FFFFFF";
  22. google_color_link = "0000FF";
  23. google_color_text = "000000";
  24. google_color_url = "008000";
  25. //-->
  26. </script>
  27. <script type="text/javascript"
  28.   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  29. </script>
  30.     </td>
  31.   </tr>
  32. </table>
  33. </body>
  34. 2.right网页:
  35. <body style="background-color:transparent; margin-left:0px; margin-top:0px;">
  36. <table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
  37.   <tr>
  38.     <td align="center" valign="bottom"><a href="#"onClick="parent.duilianad.style.display='none'">
  39. <font color="#31D7F7" size="2" style="TEXT-DECORATION: none;" >【关闭广告】</font></a></td>
  40.   </tr>
  41. </table>
  42. <table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
  43.   <tr>
  44.     <td align="center" bgcolor="#000000">
  45. <script type="text/javascript"><!--
  46. google_ad_client = "pub-7687765725679397";
  47. google_ad_width = 120;
  48. google_ad_height = 600;
  49. google_ad_format = "120x600_as";
  50. google_ad_type = "image";
  51. google_ad_channel = "";
  52. google_color_border = "336699";
  53. google_color_bg = "FFFFFF";
  54. google_color_link = "0000FF";
  55. google_color_text = "000000";
  56. google_color_url = "008000";
  57. //-->
  58. </script>
  59. <script type="text/javascript"
  60.   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  61. </script>
  62.   </td>
  63.   </tr>
  64. </table>
  65. </body>
  66. 2、再做个js调用代码如下:
  67. var delta=0.1;
  68. var collection;
  69. var closeB=false;
  70. function floaters() {
  71.   this.items = [];
  72.   this.addItem = function(id,x,y,content)
  73.       {
  74.      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>');
  75.      
  76.      var newItem    = {};
  77.      newItem.object   = document.getElementById(id);
  78.      newItem.x    = x;
  79.      newItem.y    = y;
  80.      this.items[this.items.length]  = newItem;
  81.       }
  82.   this.play = function()
  83.       {
  84.      collection    = this.items
  85.      setInterval('play()',30);
  86.       }
  87.   }
  88.   function play()
  89.   {
  90.    if(screen.width<=800 || closeB)
  91.    {
  92.     for(var i=0;i<collection.length;i++)
  93.     {
  94.      collection[i].object.style.display = 'none';
  95.     }
  96.     return;
  97.    }
  98.    for(var i=0;i<collection.length;i++)
  99.    {
  100.     var followObj  = collection[i].object;
  101.     var followObj_x  = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
  102.     var followObj_y  = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
  103.     if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
  104.      var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
  105.      dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
  106.      followObj.style.left=followObj.offsetLeft+dx;
  107.      }
  108.     if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
  109.      var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
  110.      dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
  111.      followObj.style.top=followObj.offsetTop+dy;
  112.      }
  113.     followObj.style.display = '';
  114.    }
  115.   }
  116.   function closeBanner()
  117.   {
  118.    closeB=true;
  119.    return;
  120.   }
  121. var theFloaters  = new floaters();
  122. //
  123. theFloaters.addItem('followDiv1','document.body.clientWidth-130',120,'<iframe src="/ads/right.htm" width="120" marginwidth="0" height="600" marginheight="0" align="top" scrolling="no" frameborder="0" allowtransparency=true></iframe>');
  124. theFloaters.addItem('followDiv2',10,120,'<iframe src="/ads/left.htm" width="120" marginwidth="0" height="600" marginheight="0" align="top" scrolling="no" frameborder="0" allowtransparency=true></iframe>');
  125. theFloaters.play();
  126. 3、在网页中直接调用js,调用代码如下:
  127. <div align="center" id="duilianad">
  128. <script type="text/javascript" language="javascript1.2" src="/ads/duilian.js"></SCRIPT>
  129. </div>
  130. 说明:可能会有部分错误,不过本人保证能用!
复制代码
发表于 2011-12-23 10:41:59 | 显示全部楼层

a_32

你該這麼說~~acer 驅動程式
回复 支持 反对

使用道具 举报

发表于 2012-4-6 14:26:17 | 显示全部楼层

....

围不雅,围不雅,持续搜寻出色!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

本站无意传播任何侵权软件与信息,部分资源为网友搜集或发布,仅供学习和研究使用,请支持正版。站内所发布的资源,如有侵犯你的权益,请联系我们,本站将立即改正或删除。

QQ|Archiver|手机版|小黑屋|联系我们|中华设计论坛 ( 苏ICP备20023187号-1

GMT+8, 2024-11-23 19:11

Powered by Discuz! X3.5

© 2006-2024 Daliang Team.

快速回复 返回顶部 返回列表