120、大段文字的翻滚处理

120、大段文字的翻滚处理

脚本说明:

<div style="background-color:#FFFFDD;width:155"><center><a href="javascript:movedown()">向下</a>  <a href="javascript:moveup()">向上</a>

<a href="javascript:stopscroll()">停止</a>  <a href="javascript:movetop()">到顶</a></center>

</div>

 

<SCRIPT language="JavaScript1.2">

var speed=4

 

iens6=document.all||document.getElementById

ns4=document.layers

 

if (iens6){

document.write('<div id="container" style="position:relative;width:155;height:160px;overflow:hidden;border:2px ridge white">')

document.write('<div id="content" style="position:absolute;width:155;left:0;top:0">')

}

</script>

<ilayer name="nscontainer" width=155 height=160 clip="0,0,155,160">

<layer name="nscontent" width=155 height=160 visibility=hidden>

 

<!--INSERT CONTENT HERE-->

<p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p>

<p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p><p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p><p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p><p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p><p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p><p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p><p><font size="2" face="Arial">-</font><font size="2" face="Arial"> 欢迎光临本站,在这里,你一定会有更多的发现</font></p>

</layer>

</ilayer>

 

<script language="JavaScript1.2">

if (iens6){

document.write('</div></div>')

var crossobj=document.getElementById? document.getElementById("content") : document.all.content

var contentheight=crossobj.offsetHeight

}

else if (ns4){

var crossobj=document.nscontainer.document.nscontent

var contentheight=crossobj.clip.height

}

 

function movedown(){

if (window.moveupvar) clearTimeout(moveupvar)

if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))

crossobj.style.top=parseInt(crossobj.style.top)-speed

else if (ns4&&crossobj.top>=(contentheight*(-1)+100))

crossobj.top-=speed

movedownvar=setTimeout("movedown()",100)

}

 

function moveup(){

if (window.movedownvar) clearTimeout(movedownvar)

if (iens6&&parseInt(crossobj.style.top)<=0)

crossobj.style.top=parseInt(crossobj.style.top)+speed

else if (ns4&&crossobj.top<=0)

crossobj.top+=speed

moveupvar=setTimeout("moveup()",100)

}

 

function stopscroll(){

if (window.moveupvar) clearTimeout(moveupvar)

if (window.movedownvar) clearTimeout(movedownvar)

}

 

function movetop(){

stopscroll()

if (iens6)

crossobj.style.top=0

else if (ns4)

crossobj.top=0

}

 

function getcontent_height(){

if (iens6)

contentheight=crossobj.offsetHeight

else if (ns4)

document.nscontainer.document.nscontent.visibility="show"

}

window.onload=getcontent_height

</script>

 

Write a comment

Comments: 0