KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   J2EE  HTML  JAVA   Swing   Webtip  Forums  Lyric  Free sheet music  Ringtones

Best books about Javasript

JavaScript Flashing Text in different Color

javascript, javascript detect chinese input formSee the following javascript Flashing Text in different Color demo. Click on the button

javascript, javascript detect chinese input formHow to do it?

javascript Flashing Text in different Color uses the following code to dynamically change the text color in <div> tag.


<Script language="JavaScript">

var someText = "Welcome to www.kidslovepc.com "; // the text
var aChar;
var aSentence;
var i=0; // a counter

var colors = new Array("FF0000","FFFF66","FF3399","00FFFF","FF9900","00FF00"); // the colors
var aColor; // the chosen color

function loadText()
{
// randomly choose color
aColor = colors[Math.floor(Math.random()*colors.length)];

aChar = someText.charAt(i);
if (i == 0)
aSentence = aChar;
else
aSentence += aChar;

// 50 iterations max.
if (i < 50) i++;

// For IE
if (document.all)
{
textDiv.innerHTML= "<font color='#"+aColor+"' face='Tahoma' size='5'><i>"+aSentence+"</i></font>";
setTimeout("loadText()",100);
}

// For Netscape Navigator 4
else if (document.layers)
{
document.textDiv.document.write("<font color='#"+aColor+"' face='Tahoma' size='5'><i>"+aSentence+"</i></font>");
document.textDiv.document.close();
setTimeout("loadText()",100);
}

// For other
else if (document.getElementById)
{
document.getElementById("textDiv").innerHTML = "<font color='#"+aColor+"' face='Tahoma'size='5'><i>"+aSentence+"</i></font>";
setTimeout("loadText()",100);
}
}
</SCRIPT>

 

Add <div name=textDiv><div> to you web page.

 

 

 

 

Best books about ASP & ASP.Net from Amazon
JavaScript Bible, Fifth Edition (Paperback) JavaScript & DHTML Cookbook (Paperback) JavaScript: The Definitive Guide (Paperback) Beginning JavaScript Second Edition (Paperback) JavaScript: The Complete Reference, Second Edition (Paperback)

 

Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © kidslovepc.com All rights reserved(new). Privacy|Copyright
designed by info@kidslovepc.com

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer