Home  >  Article  >  Web Front-end  >  Use js to realize the up and down scrolling effect of controlling content_form special effects

Use js to realize the up and down scrolling effect of controlling content_form special effects

WBOY
WBOYOriginal
2016-05-16 19:12:031094browse


<script> <BR>iens6=document.all||document.getElementById <BR>ns4=document.layers <br><br>//specify speed of scroll (greater=faster) <BR>var speed=10 <br><br>if (iens6){ <BR>document.write('<div id="container" style="position:relative;width:600;height:430;border:0px solid black;overflow:hidden">') <BR>document.write('<div id="content" style="position:absolute;width:590;left:0;top:0">') <BR>} <BR></script><script> <BR>if (iens6) <BR>document.write('') <BR></script><script> <BR>if (iens6){ <BR>var crossobj=document.getElementById? document.getElementById("content") : document.all.content <BR>var contentheight=crossobj.offsetHeight <BR>} <BR>else if (ns4){ <BR>var crossobj=document.nscontainer.document.nscontent <BR>var contentheight=crossobj.clip.height <BR>} <br><br>function movedown(){ <BR>if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100)) <BR>crossobj.style.top=parseInt(crossobj.style.top)-speed <BR>else if (ns4&&crossobj.top>=(contentheight*(-1)+100)) <BR>crossobj.top-=speed <BR>movedownvar=setTimeout("movedown()",100) <BR>} <br><br>function moveup(){ <BR>if (iens6&&parseInt(crossobj.style.top)<=0) <BR>crossobj.style.top=parseInt(crossobj.style.top)+speed <BR>else if (ns4&&crossobj.top<=0) <BR>crossobj.top+=speed <BR>moveupvar=setTimeout("moveup()",100) <br><br>} <br><br>function getcontent_height(){ <BR>if (iens6) <BR>contentheight=crossobj.offsetHeight <BR>else if (ns4) <BR>document.nscontainer.document.nscontent.visibility="show" <BR>} <BR>window.onload=getcontent_height <BR></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn