Text scrolling example

Source code:

<!-- Example for KLayers project http://www.kruglov.ru/klayers/ (c) Kruglov S.A. 2002 --> <script src="klayers.js"></script> <script> var KS=[] // array for scrollings var KScounter=0 function KScrolling(text,width,height,speed){ if(text.length && text.join){ text=text.join("<br>") } this.number=KScounter++ this.width=width this.height=height this.speed=speed this.text=text+"<br>"+text; KS[this.number]=this } KScrolling.prototype.print=function(){ if(isMSIE || isMozilla || isOpera5){ return ("<div id='KSborder"+this.number+"' style='width: "+this.width+"px;height: "+this.height+"px;overflow: hidden'><div id='KStext"+this.number+"' style='position: relative; top: 0px; left: 0px; visibility: hidden'>"+this.text+"</div></div>") }else if(isNC4){ return "<ilayer name='KSNN"+this.number+"' visibility='hide'><spacer type=block width="+this.width+" height="+this.height+"></ilayer>\n"+ "<layer name='KStext"+this.number+"' clip='0 0 "+this.width+" "+this.height+"' top=0 left=0 visibility='hide'>"+this.text+"</layer>" }else{ return (this.text) this.badBrowser=true } } KScrolling.prototype.scroll=function(){ if(this.badBrowser) return if(!this.layer) { this.layer=layer("KStext"+this.number) if(isNC4){ var l=layer("KSNN"+this.number) this.layer.moveTo(this.left=l.getAbsoluteLeft(),this.top=l.getAbsoluteTop()) } this.layer.show() this.offset=0 }else{ this.offset=(this.offset+1)%(this.layer.getHeight()/2) if(isNC4){ this.layer.scroll(this.left,this.top,this.width,this.height,0,this.offset) }else if(!this.badBrowser){ this.layer.moveY(-this.offset) } } setTimeout("KS["+this.number+"].scroll()",this.speed) } </script> <script> S=new KScrolling("Cross browser scrolling example",60,60,32) </script> <table cellspacing=0 cellpadding=2 border=2 width=1 height=1> <tr><td> <script> document.write(S.print()) </script> </td></tr> </table> <script> if(isNC4){ onload=function(){S.scroll()} }else{ S.scroll(); } </script>