<div id="chat">
<input type="text" name="" id="sms1" value="500" />
<input type="text" name="" id="sms2" value="700" />
<input type="text" name="" id="sms3" value="500" />
<input type="text" name="" id="sms4" value="900" />
<input type="text" name="" id="sms5" value="600" />
<input type="text" name="" id="sms6" value="500" />
</div>
<button id="sum">Click me</button>
<div id="result"></div>
<script>
window.addEventListener('load', loadContent);
function loadContent() {
sum.onclick = function() {
var len = chat.children.length, summa = 0;
while (len--) summa += +chat.children[len].value;
result.innerHTML = summa;
};
}
</script>
вариант