That's because you are executing your code before DOM is fully loaded.
This should work:
window.onload = function() {
document.getElementById('valueboxes').innerHTML = html;
};
Or you can simply put your javascript code just before </body>
tag with no need to use onload
there.