发新话题
打印

是高手的就上来,关于动网论坛的浮动广告

是高手的就上来,关于动网论坛的浮动广告

本意:
把动网论坛的浮动广告,copy下来保存在lib.asp(vbscript)文件里面,在index.asp或其它有需要的asp网页中调用,access里面有adv表保存广告的相关参数(广告开关图片地址\图片大小),把动网论坛的浮动广告代码改写成动VBScript.


动网论坛的浮动广告源码如下:
//漂浮广告 Begin

var brOK=false;
var mie=false;
var vmin=2;
var vmax=5;
var vr=1;
var timer1;
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;
}
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)
}
}
}

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();
}

function outMove(divname,url){
document.write("<span id='" + divname + "' style='height:49px;left:178px;position:absolute;top:1237px;width:70px; z-index:1000' onmouseover=stopme('" + divname + "'); onmouseout=movechip('" + divname + "');>");
document.write(url);
document.write("</span>");
}

function addMove(divname,url,x,y){
outMove(divname,url);
eval("theDiv="+divname);
theDiv.named=divname;
theDiv.vx=vmin+vmax*Math.random();
theDiv.vy=vmin+vmax*Math.random();
theDiv.w=1;
theDiv.h=1;
theDiv.xx=x;
theDiv.yy=y;
theDiv.timer1=null;
movechip(divname);
}

TOP

这个改起来,简单+浪费时间.....

基本的页面代码都一样,其他的就是vbs和js的区别,而且还不涉及到面向对象

TOP

发新话题