主题:  全屏滚动广告如何实现?

tototo

职务:普通成员
等级:1
金币:0.0
发贴:8
注册:2001/5/30 13:45:13
#12001/5/30 13:54:05
现在SINA。COM常有全屏滚动广告,一上网就是一全屏广告,然后上升---变小----最后变成一BANNER广告,(效果象是用FLASH做的,但是全屏广告图片格式是:*JPG)请各位大虾HELP! THANK



???

职务:普通成员
等级:2
金币:10.0
发贴:644
注册:2000/11/7 15:07:27
#22001/5/30 14:35:14
首先,在要加banner的页面里加如下代码:


另外,将如下代码存为move.js

lstart=0
loop=true
speed=85
pr_step=3
newspeed=800
newspeed2=0

function makeObj(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.css=(document.layers) ? eval(nest+'document.'+obj):eval(obj+'.style')
    this.scrollHeight=(document.layers) ? this.css.document.height:eval(obj+'.offsetHeight')
    this.scrollWidth=(document.layers) ? this.css.document.width:eval(obj+'.offsetWidth')
    this.up=goUp
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function goUp(speed){
    if(parseInt(this.css.top)>-(this.scrollHeight-60)){
        this.css.top=parseInt(this.css.top)-pr_step-1
        //alert("ok")
        setTimeout(this.obj+".up("+speed+")",35)
    }else {
    
        if(navigator.appName == "Netscape")
        {
            tome=setInterval(this.obj+".setClipne()",50)}
        else{
        tome=setInterval('setClipie()',50)
        tmp=divCont.style.clip;
        }
        
    }
}

function setClipne(){
    this.css.clip.right=this.css.clip.right-pr_step;
    this.css.clip.left=this.css.clip.left+pr_step;
    temp=parseInt(this.css.clip.right)-parseInt(this.css.clip.left);
    if(temp==0)
    {clearInterval(tome);
    document.divCont.document.divNews.visibility="hide";
    document.divCont.visibility="hide";
    }
}

function setClipie()
{
    newspeed=newspeed-pr_step;
    newspeed2=newspeed2+pr_step;
    temp="rect(0px "+newspeed+"px 600px "+newspeed2+"px)";
    this.css.clip=temp;
    if(newspeed    {
    clearInterval(tome);
    divNews.style.display="none"
    divCont.style.display="none"
    }
}

function slideInit(){
    oSlide=makeObj('divNews','divCont')
    oSlide.css.top=lstart
    oSlide.up(speed)
}
function myload(){
setTimeout("slideInit()",5000);
}

function preload(){
imagename=new Image();
imagename.src="bigmap.jpg";
myload()
}

function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);



document.write("
");
document.write("");
preload()

if (navigator.appName == "Netscape")
{document.write("");
preload()
}

自己注意图片名称就ok了!