You should use the onload function because you will come across less problems when trying to debug it in different browsers.
The only other way I know to simulate this effect reliably is to have a script tag block just before the at the footer of the page.