各位大虾们,浮动广告怎么做呀(有点苯的问题拉)

hltt 2004-04-10 06:10:10
如题,我打算做一个飘动的广告在屏幕范围内飘动,代码需要怎么写呢?请大虾指点一二!
...全文
104 点赞 收藏 7
写回复
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyb2003 2004-04-10
用DW里的行为也可以实现吧?
回复
hltt 2004-04-10
谢谢大家了!:)
回复
diveas 2004-04-10
4242
回复
lubaixu 2004-04-10
这个在DW里用时间线做就可以实现呀.
用javascript也可以实现的.
回复
diveas 2004-04-10
http://asp.happyflash.com/asp/list.asp?id=26

去看看,对你有帮助
回复
diveas 2004-04-10
<script>
var brOK=false;
var mie=false;
var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;
var mystop=0;
var step=0.2;

function checkbrOK()
{if(aname.indexOf("Internet Explorer")!=-1)
{if(aver>=4) brOK=navigator.javaEnabled();
mie=true;
}
if(aname.indexOf("Netscape")!=-1)
{if(aver>=4) brOK=navigator.javaEnabled();}
}
var vmin=1.5;
var vmax=3;
var vr=2;
var timer1;


function Chip(chipname,width,height)
{this.named=chipname;
this.vx=vmin+vmin;
this.vy=0;
this.w=width;
this.h=height;
this.xx=0;
this.yy=0;
this.timer1=null;
}

function movechip(chipname)
{
if(brOK && mystop==0)
{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+15;
}
chip.xx=chip.xx+chip.vx;
chip.vy=chip.vy+step;
chip.yy=chip.yy+chip.vy;



if(chip.xx<=pageX)
{chip.xx=pageX;
chip.vx=vmin;
}
if(chip.xx>=pageX+pageW-85)
{
chip.xx=pageX;
chip.vx=vmin;
chip.yy=pageY;
chip.vy=vmin+vmax;
}

if(chip.yy>(pageY+pageH-chip.h))
{
chip.yy=pageY+pageH-chip.h;
chip.vy=-chip.vy*0.65;
}

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+"')",20);
}
}

function stopme(flag)
{
brOk=true;
mystop=flag;
movechip("tome");
}

var tome;
var chip;
function tome()
{checkbrOK();
tome=new Chip("tome",80,80);
if(brOK && mystop==0)
{
movechip("tome");
}
}

ns4=(document.layers)?true:false;
ie4=(document.all)?true:false;

function cncover()
{
if(ns4){
document.cnc.left=window.innerWidth/2-400;
eval('document.cnc.top=document.'+chip.named+'.top');
document.cnc.visibility="show";
stopme(1);
mytime=setTimeout("cncout()",3000);
}else if(ie4)
{
document.all.cnc.style.left=window.document.body.offsetWidth/2-400;
document.all.cnc.style.top=parseInt(document.all.tome.style.top);
document.all.cnc.style.visibility="visible";
stopme(1);
mytime=setTimeout("cncout()",3000);
}
}

function cncout()
{
clearTimeout(mytime);
if(ns4){
document.cnc.visibility="hide";
stopme(0);
}else if(ie4)
{
document.all.cnc.style.visibility="hidden";
stopme(0);
}

}onload=tome;
</script>
<div id="tome" style="position:absolute;"><a href=# onMouseOver=cncover() onMouseOut=cncout() target="_blank"><img src=../ts/pic/gif/3.gif border=0></a></div>
<div id="cnc" style="position:absolute; left:0;top:0;;visibility:hidden;"><a href=http://www.happyflash.com/ onMouseOver=cncover() onMouseOut=cncout() target=_blank><img border=0 src=../ts/pic/gif/9.gif width=468 ></a></div>
回复
chuanyuan88 2004-04-10
下载
http://www.chinaz.com/js/index.Js

然后改一下图片路径,这样加入主页
<script language="javascript" src="js/index.JS"></script>
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告