Array.prototype.forEach.call(document.getElementsByTagName("div"), function(div){ div.innerHTML = "Hola mundo"; });
<div></div> <div></div> <div></div> <div></div>
div{ text-align: center; width: 10em; } div:nth-child(even){ background: yellow; } div:nth-child(odd){ background: lightgreen; }