<!DOCTYPE html>
<html>
<body>
<div></div>
<div></div>
<div>aaa</div>
<script type='text/javascript'>
var elements = document.getElementsByTagName('div');
for (var i = 0; i < elements.length; i++) {
elements[i].innerHTML = "foo";
}
</script>
</body>
</html>