How to create a special effect for the neon text code based on JavaScript _ javascript tips-js tutorial

Source: Internet
Author: User
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

Related Article

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.