x
 
<!DOCTYPE html>
<html>
    
<head>
    <style>
        img {width:70%;);
    </style>
    <script>
        function func1(){
            alert("Example below says: 'Page loading...'");
        }
        
        function func2(){
            alert("Example below says: 'DOMContentLoaded...'");
        }       
    </script>
</head>
<body id="main" onload="func1();">
    <p id="para"> Paragraph added...</p>
    <img id="image" src="../../../img/tutorials/javascript.png" />
        
    <script>
        document.getElementById("image").onload = function(){
            document.body.style.backgroundColor = "red";
        };
        
        window.addEventListener("DOMContentLoaded", func2);
        window.addEventListener("load", getCookies);
        
        function getCookies(){
            if(navigator.cookieEnabled == true){
                document.getElementById("para").innerHTML = "Cookies enabled in your browser";          
            }
            else{
                document.getElementById("para").innerHTML = "Cookies not enabled in your browser";
            }
        }
    </script>
</body>
</html>