<!DOCTYPE HTML>
<html>
<body>
<style>
#hell{width:765px}
#hell div{float:left;width:1px;height:1px}
</style>
<input type="button" value="stop">
<div>Blocks <span id="blocks">0</span></div>
<div id="hell"></div>
<script>
(function(){
var d = document.getElementById('hell') ,
blocks = 0, timer;
document.getElementsByTagName('input')[0].onclick = function(){
clearTimeout(timer);
alert(blocks+' blocks')
};
(function(){
var i=765, r=0, g=0, b=0;
blocks += i;
while(i--){
d.appendChild( document.createElement('div') ).style.backgroundColor = 'rgb(' + (i%3?r:++r) + ',' + (i%3-1?g:++g) + ',' + (i%3-2?b:++b) + ')';
}
document.getElementById('blocks').innerHTML = blocks;
timer = setTimeout( arguments.callee , 100 )
})()
})()
</script>
</body>
</html>