you can change a layer's content with layer.html, which would essentially be your document.write. so just put layer.html = "<p id='blah'></p>"
ok i tried this yesterday also but when i call document.getElementById("blah"), the console only displays "null". Any ideas?
if you look at the DOM tree in your inspector, you should see what you put into the layer.html
thanks for your answer. now i figured out the problem. i put my countUP.js class into a window.onload function and now it works. it was a problem within the DOM tree.