I have an aspx that has the following javascript function being ran during the onload event of the body.
Page.ClientScriptManager.RegisterStartupScrip(this.GetType(), "startup", "startClock();", true);
or using prototype
document.observe("dom:loaded", function() { // code here });