Special Text effects of javascript typing

Source: Internet
Author: User
Tags button attributes

This section uses the onMousedown event and event. button attributes. The main functions and usage are as follows.
• The setTimeout method executes an expression only once after a specified time delay after loading.
• The charAt method returns a character value at the specified index position. The index of the first character in the string is 0, the index of the second character is 1, and so on. If the index value exceeds the valid range, an empty string is returned.
<Html> <pead> <title> text effects </title> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> </pead> <body onLoad =" init (); "> <center> text effects for typing <pr/> </center> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
After running the program, a prompt message is displayed on the page, and then the characters are displayed one by one. After the characters appear one by one, you can stop printing after all the characters are printed.

Source program explanation
(1) The program first establishes a layer with the ID ttl0 for future calls. This layer is used to display printed text.
(2) The program adds an onLoad event to the <body> element. After the entire page is loaded, the event is triggered. Call the init () event processing function to process the event.
(3) In the txtTyper () function, use the charAt method to obtain a character in the string. Use the if Condition Statement to determine whether the character meets the conditions. After the conditions are met, print them on the page.
(4) In the if statement, you can also use any legal JavaScript statement to perform more complex operations.

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.