Spelling

by Евгений

HTML

<div id="t"></div>

CSS

div {
border: 1 px solid black;
background: #ddd;
padding: 5px;
margin: 5px;
font: normal 16px verdana;
width: 80px;
}

JavaScript

function typeString(elId, str, callback) {     
    var i = 1, el = document.getElementById(elId);     
    (function() {         
        el.innerHTML = str.substr(0, i++);         
        if (i > str.length) {             
            callback();         
        } else {             
            setTimeout(arguments.callee, 300);         
        }     
    })(); 
}  
typeString('t', 'Hello, World!', function() {     
    alert('Напечатали'); 
});