Sokoljr,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<form>
<button type="button">0</button>
<button type="button">1</button>
<button type="button">2</button>
<button type="button">3</button>
<button type="button">4</button>
<button type="button">5</button>
<button type="button">6</button>
<button type="button">7</button>
<button type="button">8</button>
<button type="button">9</button>
</form>
<div></div>
<script>
window.addEventListener('DOMContentLoaded', function() {
var sum = 0;
[].forEach.call(document.querySelectorAll('button'), function(item,i) {
item.addEventListener('click', function() {
document.querySelector('div').innerHTML = sum += i;
});
});
});
</script>
</body>
</html>