без цикла:
<div id="id1" style="width: 10px; height: 20px; background: red"></div>
<div id="id2" style="width: 10px; height: 20px; background: red"></div>
<div id="id3" style="width: 10px; height: 20px; background: red"></div>
<script>
alert(
document.getElementById('id1').offsetWidth +
document.getElementById('id2').offsetWidth +
document.getElementById('id3').offsetWidth
);
</script>