A colorful welcome word for a webpage is actually a special Javascript text effect, but it is only a combination of typing and colorful. It puts this effect on the corner of the webpage and adds some dynamic elements to the calm webpage.
<Title> welcome word with the same color as character input </title> <body onLoad = "loadText () "> <Script language =" JavaScript "> var someText =" Welcome to Jb51.net "; var aChar; var aSentence; var I = 0; var colors = new Array (" FF0000 ", "FFFF66", "FF3399", "00 FFFF", "FF9900", "00FF00"); var aColor; function loadText () {aColor = colors [Math. floor (Math. random () * colors. length)]; aChar = someText. charAt (I); if (I = 0) aSentence = aChar; else aSentence + = aChar; if (I <50) I ++; if (document. all) {textDiv. innerHTML = "<I>" + aSentence + "</I>"; setTimeout ("loadText ()", 100);} else if (document. layers) {document.textDiv.doc ument. write ("<I>" + aSentence + "</I>"); document.textDiv.doc ument. close (); setTimeout ("loadText ()", 100);} else if (document. getElementById) {document. getElementById ("textDiv "). innerHTML = "<I>" + aSentence + "</I>"; setTimeout ("loadText ()", 100 );}} SCRIPT <p id = "textDiv"> </p> </body>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]