An interesting JS: Random Effect text-select a random word from a piece of text at regular intervals

Source: Internet
Author: User

<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<Html>
<Head>
<Script language = "JavaScript">
<! --
Function open () {return true ;}
// -->
</SCRIPT>
<Title> Ripple Text Examples by Mark Boyle e-mail mboil@hotmail.com </title>
</Head>
<BODY bgcolor = green text = "white" bgcolor = "green" link = "yellow" vlink = "yellow"
Alink = "red">
<Font color = "yellow">
<Script language = "JavaScript">
Var speed = 20;
Var fulltext;
If (navigator. appName = "Netscape ")
Document. write ('<layer id = "wds"> </layer> <br> ');
If (navigator. appVersion. indexOf ("MSIE ")! =-1)
Document. write ('<span id = "wds"> </span> <br> ');
Function livetext ()
{
Fulltext = "this is an example of random effect text"
Var whichchar = Math. round (Math. random () * fulltext. length ))
Switch (whichchar ){
Case 0:
Fulltext = '<font color = "red">' + fulltext. substring (0, 1) + '</font>' + fulltext. substring
(1, fulltext. length );
Break;
Case fulltext. length:
Fulltext = fulltext. substring (0, fulltext. length-1) + '<font color = "red">' + fulltext. substring
(Fulltext. length-1, fulltext. length) + '</font> ';
Break;
Default:
Fulltext =
Fulltext. substring (0, whichchar) + '<font color = "violet">' +
Fulltext. substring (whichchar, whichchar + 1) + '</font>' +
Fulltext. substring (whichchar + 1, fulltext. length );
Break;
}
If (navigator. appName = "Netscape "){
Size = "<font point-size = '25pt '> ";
Document.wds.doc ument. write (size + '<center>' + fulltext + '</center> </font> ');

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.