A friend is eager to use, so write this effect, code and improve the place, we can try to modify to make it more concise, and then post it all together to share
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <HTML> <HEAD> <TITLE> New Document &L t;/title> <meta name= "generator" content= "EditPlus" > <meta name= "Author" content= "" > <meta NAME= "Key Words "content=" "> <meta name=" Description "content=" "> <style type=" text/css "> Body{margin:0px;font:" Song Body "12PX; Background-color: #000; Color: #fff} </style> <script type= "Text/javascript" > var typer={container:null, speed:100, Innerhtml:null, curpos:0, Interval1:null, Interval2:null, Init:function (obj,speed) { Typer.container = obj; if (speed) Typer.speed = speed; Typer.start (); }, Start:function () {typer.innerhtml = Clearspace (Typer.container.innerHTML). toLowerCase (); Typer.container.innerHTML = ""; Typer.interval1 = SetInterval ("Typer.type ()", typer.speed); }, Type:function () { if (typer.curpos<typer.innerhtml.length) {if (typer.container.innerHTML.substring Typer.container.innerHT Ml.length-1)!= "_") {Typer.container.innerHTML + = "_"; }else{var tempstr = ""; if (typer.innerhtml.length>=typer.curpos+4) {if (typer.innerHTML.substring Typer.curpos,typer.curpos +4 = = = "</p>") {tempstr= "</p>"; Typer.curpos = typer.curpos+4; }else if (typer.innerHTML.substring (typer.curpos,typer.curpos+4) = = "") {tempstr= ""; Typer.curpos = typer.curpos+4; }else{if (typer.innerhtml.length>=typer.curpos+3 && typer.innerHTML.substring (typer.cu rpos,typer.curpos+3) = = "<p>") {tempstr= "<p>"; Typer.curpos = typer.curpos+3; }else{tempstr=typer.innerhtml.substring (typer.curpos,typer.curpos+1); typer.curpos++; }}else if (typer.innerhtml.length>=typer.curpos+3) {if (Typ Er.innerHTML.substring (typer.curpos,typer.curpos+3) = = "<p>") {tempstr= "<p>"; Typer.curpos = typer.curpos+3; }else{tempstr=typer.innerhtml.substring (typer.curpos,typer.curpos+1); typer.curpos++; }}else{tempstr=typer.innerhtml.substring (typer.curpos,typer.curpos+1); typer.curpos++; } Typer.container.innerHTML = typer.container.innerHTML.substring (0,typer.container.innerhtml.length-1) +t EMPSTR; }}else{clearinterval (TYPER.INTERVAL1); Typer.interval2 = SetInterval ("Typer.last ()", typer.speed); }, Last:function () {if typer.container.innerHTML.substring (typer.container.innerhtml.length-1)!= "_" ) Typer.container.innerHTML + = "_"; else Typer.container.innerHTML = typer.container.innerHTML.substring (0,typer.container.innerhtml.length-1); } function Clearspace (str) {if (str!= "") {str = str.replace (/^\s*/g, ""). Replace (/\s*$/g, ""); return str; } </script> </HEAD> <body onload= "Typer.init (document.getElementById (' View ')" > <div id= "View" song Body ' 12px; Background-color: #000; Color: #fff "> Name: Cold Wind email:cityvoice@hotmail.com Birthplace: Hunan <p> Hobbies: Playing, traveling, playing StarCraft, singing </p> </div> </ Body> </HTML>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]