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

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.