欢迎来到福编程网,本站提供各种互联网专业知识!

用js实现控制内容的向上向下滚动效果

发布时间:2007-06-26 作者: 来源:转载
iens6=document.all||document.getElementByIdns4=document.layers//specifyspeedofscroll(greater=faster)varspeed=10if(iens6){document.write('')document.write('')}if(iens6)document.write('')if(iens6){varcrossobj=document.getElementById?doc

iens6=document.all||document.getElementById
ns4=document.layers

//specifyspeedofscroll(greater=faster)
varspeed=10

if(iens6){
document.write('')
document.write('')
}


if(iens6)
document.write('

')


if(iens6){
varcrossobj=document.getElementById?document.getElementById("content"):document.all.content
varcontentheight=crossobj.offsetHeight
}
elseif(ns4){
varcrossobj=document.nscontainer.document.nscontent
varcontentheight=crossobj.clip.height
}

functionmovedown(){
if(iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed
elseif(ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",100)
}

functionmoveup(){
if(iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+speed
elseif(ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",100)

}

functiongetcontent_height(){
if(iens6)
contentheight=crossobj.offsetHeight
elseif(ns4)
document.nscontainer.document.nscontent.visibility="show"
}
window.onload=getcontent_height

相关推荐