飞龙 发表于 2010-10-23 10:07:41

GG的对联广告做法代码带关闭按钮

GG的对联广告做法代码带关闭按钮

1、首先做2个htm网页,内容如下
1.left网页:
<body style="background-color:transparent; TEXT-DECORATION:none; margin-left:0px; margin-top:0px;">
<table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td align="center" valign="bottom"><a href="#"onClick="parent.duilianad.style.display='none'">
<font color="#31D7F7" size="2" style="TEXT-DECORATION: none;">【关闭广告】</font></a></td>
</tr>
</table>
<table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td align="center" bgcolor="#000000">
<script type="text/javascript"><!--
google_ad_client = "pub-7687765725679397";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "image";
google_ad_channel = "";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
    </td>
</tr>
</table>
</body>
2.right网页:
<body style="background-color:transparent; margin-left:0px; margin-top:0px;">
<table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td align="center" valign="bottom"><a href="#"onClick="parent.duilianad.style.display='none'">
<font color="#31D7F7" size="2" style="TEXT-DECORATION: none;" >【关闭广告】</font></a></td>
</tr>
</table>
<table width="120" height="%100" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td align="center" bgcolor="#000000">
<script type="text/javascript"><!--
google_ad_client = "pub-7687765725679397";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "image";
google_ad_channel = "";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>
</body>
2、再做个js调用代码如下:
var delta=0.1;
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= 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.object.style.display = 'none';
    }
    return;
   }
   for(var i=0;i<collection.length;i++)
   {
    var followObj= collection.object;
    var followObj_x= (typeof(collection.x)=='string'?eval(collection.x):collection.x);
    var followObj_y= (typeof(collection.y)=='string'?eval(collection.y):collection.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-130',120,'<iframe src="/ads/right.htm" width="120" marginwidth="0" height="600" marginheight="0" align="top" scrolling="no" frameborder="0" allowtransparency=true></iframe>');
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>');
theFloaters.play();
3、在网页中直接调用js,调用代码如下:
<div align="center" id="duilianad">
<script type="text/javascript" language="javascript1.2" src="/ads/duilian.js"></SCRIPT>
</div>
说明:可能会有部分错误,不过本人保证能用!

kebaotaok 发表于 2011-12-23 10:41:59

a_32

你該這麼說~~acer 驅動程式

kikakicc 发表于 2012-4-6 14:26:17

....

围不雅,围不雅,持续搜寻出色!!
页: [1]
查看完整版本: GG的对联广告做法代码带关闭按钮