对联广告代码3

在<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
下成功。
<script>
//浏览器窗口参数定义及获取函数,兼容IE6&MF by nokersang *
var theX; //浏览器窗口宽度
if(document.documentElement.clientWidth<document.body.clientWidth&&document.documentElement.clientWidth){
 theX = 'document.documentElement.clientWidth';
}else{
 theX = 'document.body.clientWidth';
}

var theY; //浏览器窗口高度
if(document.documentElement.clientHeight<=document.body.clientHeight&&document.documentElement.clientHeight){
 theY = 'document.documentElement.clientHeight';
}else{
 theY = 'document.body.clientHeight';
}

function scrollTop() //浏览器滚动条位置
{
 var scrollTop;
 if (document.documentElement && document.documentElement.scrollTop){
  scrollTop = document.documentElement.scrollTop;
 }else if (document.body){
  scrollTop = document.body.scrollTop;
 }else if (window.pageYOffset){
  scrollTop = window.pageYOffset;
 }
 return scrollTop;
}

// 参数设置,包括广告显示数量、广告文件的规格、类型、地址和广告边距,左右可使用不同设置,如果设置了不显示某侧广告那么该广告的所有参数设置都无效
var delta=0.075;
var collection,right_ad,left_ad,LeftAd_Type,RighAd_Type;

if(contentWidth == null)//判断参数contentWidth是否存在,便于接受页面参数为不同内容宽度页面定制浮动 by nokersang
{
var contentWidth=780;//页面内容区域宽度,建议使用4的整数倍
}

var maxHeight=410;//定义可见的浮动内容最下沿距浏览器窗口内容部分顶端的高度,建议留几像素余地

var display="both"//设定广告显示数量。left:只显示左侧;right:只显示右侧;both:全部显示;none:全部关闭
 
var LeftAd_Type="pic";//设定左侧广告类型,swf:flash文件;pic:jpg或gif文件
var LeftAd_Dime="d"//设定左侧广告规格。d:对联类 100*300;f:浮标类 80*80
var LeftAd_Url="/images/duilian_1.gif";//设定左广告文件的地址
var LeftAd_link="http://www.shineson.com/default.html";//设置左侧广告的跳转连接地址(flash无须设置)
var LeftAd_top=80;//设定左广告top边距(常规情况无需更改)
var LeftAd_left=eval(theX)<=(contentWidth+200)?0:Math.round((eval(theX)-contentWidth) *0.25-50);//设定左广告left边距,浮动在内容之外空间上自动居中 by nokersang

var RightAd_Type="pic";//设定右侧广告类型,swf:flash文件;pic:jpg或gif文件
var RightAd_Dime="d"//设定右侧广告规格。d:对联类 100*300;f:浮标类 80*80
var RightAd_Url="/images/duilian_2.gif";//设定右广告文件的地址
var RightAd_link="http://www.shineson.com/default.html";//设置右侧广告的跳转连接地址(flash无须设置)
var RightAd_top=80;//设定右广告top边距(常规情况无需更改)
var RightAd_left=eval(theX)>(contentWidth+200)?Math.round(eval(theX)*0.75+ contentWidth*0.25-50):Math.round(screen.width*0.75+125);//设定右广告left边距,浮动在内容之外空间上自动居中 by nokersang

// "返回顶部"的设置
var ifGoTop="y";//是否出现“返回顶部”。y:出现;n:隐藏

//以下代码无须改动
//var gotop="<table width=100 border=0 cellpadding=0 cellspacing=0> <tr> <td></td> <td><a onClick=\"javascript:window.scroll(0,0);return false;\" style=\"cursor:pointer\" onmouseover=\'this.style.color=\"#AAA\"\' onmouseout=\'this.style.color=\"#000\"\'>返回页顶</a></td> </tr></table>"// 对联返回改为js方式 by jornnyliu
  var gotop="";
if (LeftAd_Type=="pic"&&LeftAd_Dime=="d"){
  left_ad="<table width=100 border=0 cellspacing=0 cellpadding=0 style='float:left;margin-left:5px;'><tr><td height=24  align=right></td> </tr> <tr> <td height=276 align=center valign=middle ><a href="+LeftAd_link+" target=_blank><img src="+LeftAd_Url+" width=100  border=0 /></a></td> </tr> </table>";
 }
if (LeftAd_Type=="pic"&&LeftAd_Dime=="f"){
  left_ad="<a href="+LeftAd_link+" target=_blank><img src="+LeftAd_Url+" width=80 height=80 border=0 /></a>";
 }
if (RightAd_Type=="pic"&&RightAd_Dime=="d"){
  right_ad="<table width=100 border=0 cellspacing=0 cellpadding=0> <tr> <td height=24  align=right></td> </tr> <tr> <td height=276 align=center valign=middle ><a href="+RightAd_link+" target=_blank><img src="+RightAd_Url+" width=100  border=0 /></a></td> </tr> </table>"
 }
if (RightAd_Type=="pic"&&RightAd_Dime=="f"){
  right_ad="<a href="+RightAd_link+" target=_blank><img src="+RightAd_Url+" width=80 height=80 border=0 /></a>";
 }
if (LeftAd_Type=="swf"&&LeftAd_Dime=="d"){
  left_ad="<object id=flashad classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"100\" height=\"300\"> <param name=\"movie\" value=\""+LeftAd_Url+"\" /> <param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\""+LeftAd_Url+"\" width=\"100\" height=\"300\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed> </object>";
 }
if (LeftAd_Type=="swf"&&LeftAd_Dime=="f"){
  left_ad="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"80\" height=\"80\"> <param name=\"movie\" value=\""+LeftAd_Url+"\" /> <param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\""+LeftAd_Url+"\" width=\"80\" height=\"80\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed> </object>";
 }
if (RightAd_Type=="swf"&&RightAd_Dime=="d"){
  right_ad="<object id=flashad classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"100\" height=\"300\"> <param name=\"movie\" value=\""+RightAd_Url+"\" /> <param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\""+RightAd_Url+"\" width=\"100\" height=\"300\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed> </object>";
 }
if (RightAd_Type=="swf"&&RightAd_Dime=="f"){
  right_ad="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"80\" height=\"80\"> <param name=\"movie\" value=\""+RightAd_Url+"\" /> <param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\""+RightAd_Url+"\" width=\"80\" height=\"80\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed> </object>";
 }

function floaters() {
 this.items = [];
 this.addItem = function(id,x,y,content){
  var str = '<DIV id='+id+' style="Z-INDEX:10; POSITION: absolute;display:block;left:'+(typeof(x)=='string'?eval(x):x)+'px;top:'+(typeof(y)=='string'?eval(y):y)+'px">'+content+'</DIV>';
  document.write(str);

  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(){
 //动态根据窗口大小判断隐藏 by nokersang
 if(eval(theX)<parseInt(contentWidth+200)||eval(theY)<maxHeight){
  for(var i=0;i<collection.length;i++)
   {
   collection[i].x=(collection[i].object.offsetLeft?collection[i].object.offsetLeft:collection[i].x);//MF层位置保存,兼容代码 nokersang
   collection[i].object.style.display="none";
   }
 }else{
  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(collection[i].object.style.display!="block"){
    followObj.style.left=followObj_x+"px" //MF层位置获取,兼容代码 nokersang
    collection[i].object.style.display="block";
   }
   //左右浮动区别处理动态处理代码,动态浮动,解决窗口水平变小时Flash跳动及短时间出现水平滚动条问题 by nokersang *
   if(i==0&&display!="right"){
    if(followObj.offsetLeft!=Math.round((eval(theX)-contentWidth)*0.25-50)){
    var dx=((eval(theX)-contentWidth)*0.25-50-followObj.offsetLeft)*delta;
    dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
    followObj.style.left=followObj.offsetLeft+dx+"px";
    }
   }else{
    if(followObj.offsetLeft!=Math.round(eval(theX)*0.75+contentWidth*0.25-50)){
    var dx=(Math.ceil(eval(theX)*0.75+contentWidth*0.25-50)-followObj.offsetLeft);
    dx=(dx<0&&(followObj.offsetLeft+100)>eval(theX)?dx:dx*delta);
    dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));

    followObj.style.left=followObj.offsetLeft+dx+"px";
    }
   }
   if(followObj.offsetTop!=(scrollTop()+followObj_y)) {
    var dy=(scrollTop()+followObj_y-followObj.offsetTop)*delta;
    dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
    followObj.style.top=followObj.offsetTop+dy+"px";
   }
   collection[i].object.style.display="block";
  }
 }
} 

var theFloaters = new floaters();
 
if (display=="both"){
 theFloaters.addItem('leftad',LeftAd_left,LeftAd_top,left_ad);
 theFloaters.addItem('rightad',RightAd_left,RightAd_top,right_ad);
}
if (display=="left"){
 theFloaters.addItem('leftad',LeftAd_left,LeftAd_top,left_ad);
}
if (display=="right"){
 theFloaters.addItem('rightad',RightAd_left,RightAd_top,right_ad);
}
if (ifGoTop=="y"){
 theFloaters.addItem('gotop',RightAd_left,390,gotop);
}
theFloaters.play();
</script>
300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00469 秒