The reason for this is to be sure that the script is loaded before the function is called.
Body section Execute a script that is placed in the body section.
Scripts in the body section are executed when the page is loading. Where to Put the VBScript Scripts in a page will be executed immediately while the page loads into the browser. This is not always what we want. Sometimes we want to execute a script when a page loads, other times when a user triggers an event. We Help You For Free.