I attempted to develop a code that would hide my page until it has fully loaded. However, the code I created did not produce the desired outcome. Instead of hiding the BODY
element until the OnLoad
event occurred, it remained hidden at all times.
If anyone could provide assistance and suggest a more effective method for concealing the BODY
while it loads or identify what is wrong with the current approach, it would be greatly appreciated.
This is what I have experimented with so far:
function unveil() {
var thebod = document.getElementById("testbody");
thebod.STYLE = "display: block;"
}
<HTML>
<HEAD>
<TITLE>HELLO</TITLE>
</HEAD>
<BODY ID="testbody" ONLOAD="unveil();" STYLE="display: none;">
<div align="CENTER">
HELLO WORLD!
</div>
</BODY>
</HTML>