An interesting JS: Random effect text-timed to randomly select a character from a piece of text and change the color. Can learn a bit JS.

Source: Internet
Author: User
js| Timing | Random <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<script language= "JavaScript" >
<!--
function open () {return true;}
-->
</SCRIPT>
<title>ripple Text Examples by Mark Boyle email mboil@hotmail.com</title>

<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 a 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.document.write (size+ ' <center> ' + fulltext + ' </center></font> ');
Document.wds.document.close ();
}
if (Navigator.appVersion.indexOf ("MSIE")!=-1) {
wds.innerhtml = ' <center> ' + fulltext + ' </center><p> ';
Wds.style.fontsize= ' 25px '
}

SetTimeout ("Livetext ()", speed);
}

Livetext ()

</script>

</font>

</BODY>



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.