Here, JS is used to implement the special effect code of the neon text on the webpage. If you look at the running effect, you will see that the color of the text is like a neon light, continuously changing, colorful, and dazzling, therefore, it is called a neon text, or it can be called a text color effect. The following describes how to use JavaScript to create a special effect for the neon text Code. For Example 1:
The running effect is as follows:
The Code is as follows:
Http-equiv = "Content-Type" content = "text/html; charset = gb2312">
Neon lights
Var Tname = "Welcome! "; Var Tlen = Tname. length; document. write ("+ Tname +" "); var col = new Array (" # FFCC00 "," # 3333FF "," # FFCC00 "," # FF0000 ", "# FFCC00", "# CC33FF"); var ic = 0; function Dcolor () {var Strname = ""; for (I = 0; iTlen; ++ I) {var Strname = Strname + "+ col [ic] +"> "+ Tname. substring (I, I + 1) + "; ic = ic + 1; if (ic = col. length) ic = 0;}. innerHTML = Strname; setTimeout ("Dcolor ()", 200);} Dcolor (); class = "style5">
Example 2:
As follows:
Download demo effect source code