page onload function register





11
Date Submitted Fri. Aug. 4th, 2006 10:13 AM
Revision 1 of 1
Syntax Master sundaramkumar
Tags HTML | JavaScript
Comments 2 comments
This function will run all functions that are to be executed one by one on page load with specified/added orde


     <script>
 var onloads = new Array();
      function bodyOnLoad() {
         for ( var i = 0 ; i < onloads.length ; i++ )
            onloads[i]();
      }
 function test1(){
 ....
}
 function test2(){
 ....
}
</script>

<body onload="bodyOnLoad()">
        <script> onloads.push( test1);
 onloads.push( test2);
</script>
</body>


 

Comments

Comments Better Choice
Thu. Oct. 5th, 2006 6:06 AM    Helper Thomas
Comments more simple
Thu. Aug. 10th, 2006 7:34 AM    Newbie fabioso

Voting