1//two ways of executing JS code after page is loaded, use "DOMContentLoaded" when able
2
3document.addEventListener("DOMContentLoaded", function(){
4 //dom is fully loaded, but maybe waiting on images & css files
5});
6
7window.addEventListener("load", function(){
8 //everything is fully loaded, don't use me if you can use DOMContentLoaded
9});
1/* javascript function is executed after 5 seconds page was loaded */
2window.onload = function() {
3 setTimeout(loadAfterTime, 5000)
4};
5
6function loadAfterTime(){
7 document.getElementById("menu").style.display="block";
8}