var text = "", count = -1; function textType () { if(!document.getElementById) return; var obj = document.getElementById("msg"); if(!text) text = obj.firstChild.nodeValue; if(count >= 0) { obj.firstChild.nodeValue = text.substr(0, count + 1); obj.style.color = "blue"; } count++; if(count < text.length) setTimeout("textType();", 200); } if(document.getElementById) { document.write(""); }