Interval counter
by Alon Rotem
HTML
<div id="res"></div>
JavaScript
var from = 0;
var to = 50;
var counter = from;
var timer = window.setInterval(function() {
$("#res").html(counter);
counter++;
if(counter == to)
{
window.clearInterval(timer);
$("#res").html("Done.");
}
}, 100);