Scrolling of text
<body> <textarea id= "textarea" ></textarea> <script> str= "Scrolling effect of text" ; function Roll () { str=str.substr (1,str.length) +str.substring (0,1); document.getElementById ("textarea"). Style.fontsize= "20px"; document.getElementById ("textarea"). innertext=str; } SetInterval (roll,N); </script></body>
Printing of text
<body> <textarea id= "textarea" ></textarea> <script> var str= " The print effect of the text "; var index=0; function type () { if(index = = str.length+1) {= 0; } document.getElementById ("textarea"). Style.fontsize= "15px"; document.getElementById ("textarea"). InnerText = str.substring (0, index++); } ); </script></body>
The color of the text flashes
<body> <span id= "S1" > Text </span> <span id= "s2" > Word </span> <span id= "S3" > </span > <span id= "s4" > Yan </span> <span id= "S5" > Colors </span> <span id= "S6" > Flash </span> <span id= "S7" > </span> <script>Str= "Color of text flashes"; functioncolor () {R=math.floor (Math.random () *256); G=math.floor (Math.random () *256); b=math.floor (Math.random () *256); return"RGB (" +r+ "," +g+ "," +b+ ")" } functionWord () {document.getElementById ("S1"). style.color=color (); document.getElementById ("S2"). style.color=color (); document.getElementById ("S3"). style.color=color (); document.getElementById ("S4"). style.color=color (); document.getElementById ("S5"). style.color=color (); document.getElementById ("S6"). style.color=color (); document.getElementById ("S7"). style.color=color (); } setinterval (Word,500); </script></body>
JavaScript uses random numbers and timers to complete a few useful text scrolling effects of small manipulation text, the print effect of text and the color of text flashing