The most common way to call a script function is to have an element trap an event, which in turn calls the function, as in:
Click here
But what if you want a function to perform a task as soon as the page loads without any user input? In that case, you can use the onload event, placing it in the Body element of your page, as in:
The function will be called immediately after the page loads, and no user input is required.