Marqueen in HTML can also realize scrolling of content, but the scrolling is intermittent. During a scrolling cycle, a blank period will appear. If the scrolling area is relatively large, the appearance of space will make the page look ugly. Using JavaScript can improve this problem and achieve uninterrupted scrolling.
Scroll up and down the code:
< ;div id="demo1">
111111111111111
22222222222222
33333333333333
444444444444444< ;br>
555555555555555
<script> <br>var t=getid("demo"),t1=getid(" demo1"),t2=getid("demo2"),sh=getid("show"); <br>var inter; <br>t2.innerHTML=t1.innerHTML; <br>function qswhMarquee(){ <br> if(t2.offsetTop<=t.scrollTop) <BR>t.scrollTop-=t1.offsetHeight; <BR>else <BR>t.scrollTop; <BR>} <BR>inter=setInterval(qswhMarquee,30); <BR>function getid(id){ <BR>return document.getElementById(id); <BR>} <BR></script>
Yu Zhiguo Website Design Studio provides professional foreign trade website building services.