<div>0</div>
<button>stop</button>
<script>
window.onload = function () {
var div = document.body.children[0];
var but = document.body.children[1];
var int = setInterval(function () {div.innerHTML = parseInt(div.innerHTML) + 100}, 2000);
but.onclick = function () {
clearInterval(int);
alert(div.innerHTML);
}
}
</script>