Set form value before the form is showing

Hi!
How can I set a form value while the page is loading or before it loads? It works fine with a click event or submit form, but I want it to happend while the page is loading.