JavaScript pages automatically load events


**Method 1: **

 Window.onload=function(){
   Var name=document.getElementById( " name " ).val();//Load the HTML, and load all external reference files (images, CSS styles, js, etc.)
}

**Method 2: need to introduce Jquery’s.js file **

$(document).ready(function(){
         alert("JQuery The first entry case ");//Load the HTML, without waiting, immediately
});

**Method 3: (equivalent to method 2) **

jQuery(function (){
       if($("input[name='message']").val()!="")
           alert($("input[name='message']").attr("value"));
});

**Method 4 :(same as above) **

$(function (){
    alert("JQuery  Executed when the page is automatically loaded  1 ....");
 });

**Method 5-1: window.onload event (load multiple functions at the same time…) **

<html>
    <body onload="function1(),function2(),function3()">
   </body>
</html>
<script >
 function1(){
 }
function2(){
}
function3(){
}
</script>

**Method 5-2: window.onload event (load multiple functions at the same time…) **

<html>
    <body>
    </body>
<html>
<script>
   function1(){
   }
   function2(){
   }
   function3(){
   }
   window.onload=function(){
    function1();
    function2();
    function3();
   }
</script>