浮动广告

(1)漂浮不定的广告
<script language="javascript">
var brOK=false;
var mie=false;
var vmin=2;
var vmax=5;
var vr=1;
var timer1;
var chinazads;
var isflash=0;    //是否为FLASH文件的漂浮 1=是 0=否
var pic="http://www.9984.net/js/114.gif";   //图片的地址
var alt="支持本站,请点击广告赞助商"; //鼠标放在图片上时显示的提示文字
var url="http://ad.114.com.cn/9984.html";  //图片链接的地址
var flashurl="http://www.9984.net/js/114.gif";  //FLASH文件的路径
var Wimg=100;    //图像的宽度
var Himg=100;    //图像的高度
function movechip(chipname)
{
 if(brOK)
 {
  eval("chip="+chipname);
  if(!mie)
  {
   pageX=window.pageXOffset;
   pageW=window.innerWidth;
   pageY=window.pageYOffset;
   pageH=window.innerHeight;
  }
  else
  {
   pageX=window.document.body.scrollLeft;
   pageW=window.document.body.offsetWidth-8;
   pageY=window.document.body.scrollTop;
   pageH=window.document.body.offsetHeight-Himg-10;
  }
  chip.xx=chip.xx+chip.vx;
  chip.yy=chip.yy+chip.vy;
  chip.vx+=vr*(Math.random()-0.5);
  chip.vy+=vr*(Math.random()-0.5);
  if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;
  if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
  if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;
  if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;
  if(chip.xx<=pageX)
  {
   chip.xx=pageX;
   chip.vx=vmin+vmax*Math.random();
  }
  if(chip.xx>=pageX+pageW-chip.w)
  {
   chip.xx=pageX+pageW-chip.w;
   chip.vx=-vmin-vmax*Math.random();
  }
  if(chip.xx>=680)
  {
   chip.xx=chip.xx-20;
   chip.vx=-vmin-vmax*Math.random();
  }
  if(chip.yy<=pageY)
  {
   chip.yy=pageY;
   chip.vy=vmin+vmax*Math.random();
  }
  if(chip.yy>=pageY+pageH-chip.h)
  {
   chip.yy=pageY+pageH-chip.h;
   chip.vy=-vmin-vmax*Math.random();
  }
  if(!mie)
  {
   eval('document.'+chip.named+'.top ='+chip.yy);
   eval('document.'+chip.named+'.left='+chip.xx);
  }
  else
  {
   eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
   eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);
  }
  chip.timer1=setTimeout("movechip('"+chip.named+"')",80);
 }
}

function stopme(chipname)
{
 if(brOK)
 {
  eval("chip="+chipname);
  if(chip.timer1!=null)
  {
   clearTimeout(chip.timer1)
  }
 }
}

function chinazads()
{
 if(navigator.appName.indexOf("Internet Explorer")!=-1)
 {
  if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();mie=true;
 }
 if(navigator.appName.indexOf("Netscape")!=-1)
 {
  if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();
 }
 chinazads.named="chinazads";
 chinazads.vx=vmin+vmax*Math.random();
 chinazads.vy=vmin+vmax*Math.random();
 chinazads.w=1;
 chinazads.h=1;
 chinazads.xx=0;
 chinazads.yy=0;
 chinazads.timer1=null;
 movechip("chinazads");
}

document.write('<div id="chinazads" style="height:49px;left:178px;position:absolute;top:1237px;width:70px; z-index:1000">');
//if (isflash>0)
//{
//document.write("<EMBED src='" + flashurl + "' quality=high  WIDTH='" + Wimg + "' HEIGHT='" + Himg + "' TYPE='application/x-shockwave-flash'></EMBED>");
//}
//else
//{
document.write("<a href='" + url + "' target=_blank οnmοuseοver=stopme('chinazads'); οnmοuseοut=movechip('chinazads');>");
document.write("<img src='" + pic + "' alt='" + alt + "' border=0 width='" + Wimg + "' height='" + Himg + "'></a>");
//}
document.write("</div>");
chinazads();
</script>

(2)固定在窗口的广告
<script language="javascript">

var imgleft, imgheight;

var isNS  = (document.layers)?true:false;  //NS4:true ie/ns6、7:false
window.screen.width>800 ? imgheight=150:imgheight=150
window.screen.width>800 ? imgleft=15:imgleft=120

function leftmove()
{
  if(isNS)
  {
    document.myleft.top=pageYOffset+window.innerHeight-imgheight;
    document.myleft.left=imgleft;
    setTimeout("leftmove();",80)
  }
  else
  {
    myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight-150;
    myleft.style.left=imgleft;
    setTimeout("leftmove();",80)
 }
}

function myLeftload()
{
  if (isNS)
  {
    document.myleft.pageY=pageYOffset+window.innerHeight-imgheight;
    document.myleft.pageX=imgleft;
    leftmove();
  }
  else
  {
    myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight-150;
    myleft.style.left=imgleft;
    leftmove();
  }
}

if (isNS)
{
document.write("<layer id=myleft top=300 width=80 height=80>");
document.write("<a href=http://www.csdn.net/csdn/csdnClick.aspx?ad=tarena&adurl&adurl=http://www.fortinet.com.cn/company/jobs.html target=_blank>");
document.write("<img src='/adv/homepage/6666.gif' width=80 HEIGHT=80 border=0></a>");
document.write("</layer>");
myLeftload()}
else
{
document.write("<div id=myleft style='position: absolute;width:80;top:300;left:5;visibility: visible;z-index: 1'>");
document.write("<a href=http://www.csdn.net/csdn/csdnClick.aspx?ad=tarena&adurl&adurl=http://www.fortinet.com.cn/company/jobs.html target=_blank>");
document.write("<img src='/adv/homepage/6666.gif' width=80 HEIGHT=80 border=0></a>");
document.write("</div>");
myLeftload()
}
</script>

//
//   pageX=window.document.body.scrollLeft;
//   pageW=window.document.body.offsetWidth-8;
//   pageY=window.document.body.scrollTop;
//   pageH=window.document.body.offsetHeight-Himg-10;
window.screen.width>800 ? imgheight=150:imgheight=150
window.screen.width>800 ? imgright=window.screen.width-15-120:imgright=window.screen.width-120-120
function myRightload()
{
if (navigator.appName == "Netscape")
{document.myright.pageY=pageYOffset+window.innerHeight-imgheight;
document.myright.pageX=imgright;
rightmove();
}
else
{
myright.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight-150;
myright.style.left=imgright;
rightmove();
}
}
function rightmove()
 {
 if(document.ns)
 {
 document.myright.top=pageYOffset+window.innerHeight-imgheight
 document.myright.left=imgright;
 setTimeout("rightmove();",80)
 }
 else
 {
 myright.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight-150;
 myright.style.left=imgright;
 setTimeout("rightmove();",80)
 }
 }
//

// 来自 http://www.csdn.net/
// http://www.9984.net/soft/3391.htm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值