<a href="#" onclick="startTimer(0, 20); return false;">Start Timer</a>
<span id="timer"></span>
<script>
function startTimer(start, stop) {
if (start <= stop) {
start++;
document.getElementById('timer').innerHTML = start;
setTimeout(function() {
startTimer(start, stop);
}, 100);
}
else document.getElementById('timer').innerHTML = stop;
}
</script>