Make sure the viewer can see the text and continue scrolling up and down.
<ptml> <pead> <title> text scrolling </title> <style type= "Text/css" > #infozone {font-size:12px; Color: #aa6; overflow:hidden;width:98px;height:20px;} #infozone Div{height:20px;line-height:20px;white-space:nowrap;overflow:hidden;} </style> <script type= "Text/javascript" > var tc; Window.onload=function () {var O=document.getelementbyid (' Infozone '); HScroll (o); Window.setinterval (function () {window.cleartimeout (TC); o.firstchild.style.marginleft= ' 0px '; Scrollup (o,20,0);}, 8000); The function Scrollup (o,d,c) {if (d==c) {var t=o.firstchild.clonenode (true); O.removechild (O.firstchild); O.appendchild (t); t.style.margintop=o.firstchild.style.margintop= ' 0px '; HScroll (o); } else{Ch=false;var s=3,c=c+s,l= (c>=d?c-d:0); o.firstchild.style.margintop=-c+l+ ' px '; Window.settimeout (function () {Scrollup (o,d,c-l)},50); } function HScroll (o) {var w1=o.firstchild.offsetwidth,w2=o.offsetwidth; if (W1<=W2) return; Tc=window.settimeout (function () {HS (O,W1-W2, 0,w1-w2)},3500); function HS (o,d,c,p) {C++;var t= (c>0?-c:c); o.firstchild.style.marginleft=t+ ' px '; if (C==d) {if (d==0) {tc=window.settimeout (function () {HS (O,P,0,P)},2500);} else Tc=window.settimeout (function () {HS (O,0,-P,P)},3500);} else Tc=window.settimeout (function () {HS (O,D,C,P)},5); } </script> </pead> <body> <div id= "Infozone" ><div> Blue and White porcelain (jay) </div><div> Life has you (wood age) </div><div> mythology (Sun Nan, han) </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]