Js typing result code

Source: Internet
Author: User
Tip: you can modify some code before running

<script language=javascript>Var style = document. all, both = style, idme = 908601;<!--定义变量-->If (style) {layerRef = 'document. All'; styleRef = '. Style ';}<!--对变量进行赋值-->Function writeOnText (obj, str) {eval (obj + '. innerHTML = str ');<!--向窗口中写入字符串-->} Var dispStr = new Array ("Welcome to the javascript world! "); Var overMe = 0; function txtTyper (str, idx, idObj, spObj, clr1, clr2, delay, plysnd) {if (both & idx <= str. length) {if (str. charAt (idx) = '<') {while (str. charAt (idx )! = '>') Idx ++;} if (str. charAt (idx) = '& str. charAt (idx + 1 )! = '') {While (str. charAt (idx )! = ';') Idx ++;} tmp0 = str. slice (0, idx );<!--获得字符串的一部分-->Tmp1 = str. charAt (idx ++); if (overMe = 0 & plysnd = 1) overMe = 1;<!--标志位改变-->Else overMe = 0;<!--标志位改变-->WriteOnText (idObj ,"<font color='"+clr1+"'>"+ Tmp0 +"</font><font color='"+clr2+"'>"+ Tmp1 +"</font>");<!--获得待显示的字符串-->SetTimeout ("txtTyper ('" + str + "'," + idx + ", '" + idObj + "', '" + spObj + "', '"+ clr1 +"', '"+ clr2 +"', "+ delay +", "+ plysnd +") ", delay );<!--设置逐个显示的频率-->} Function init () {txtTyper (dispStr [0], 0, 'ttl0', 'ttl1', '#339933', '# 99ff33', 300, 0 );<!--设置参数,调用函数txtTyper-->}</script><body onload=init() ><DIV class=ttl1 id=ttl0></dIV></body></html><!--本例程实现了呈变色并逐个显示的文字--><!--同时本例程还支持对喇叭的调用--><!--定时器的使用--><!--逐个显示效果的实现过程-->
Tip: you can modify some code before running

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.