I found this tip on the official DNN forums and I think it's good to have it here.
Posted on DNN forums by John Mitchell:
You can execute your script onLoad by adding the following cross-browser code to the top of your Javascript file:
if (window.addEventListener){
window.addEventListener("load", Your_Function_Name, false);
}
else if (window.attachEvent){
window.attachEvent("onload", Your_Function_Name);
}
Just replace the Your_Function_Name with the name of the function you want to execute, no quotes or parentheses.
The thread on DNN forums:
Add onLoad event handler into the BODY tag