I think you need to clarify what you mean. When do you want the form to be submitted?
Immediately after the page has loaded without any user interaction?
When a user clicks submit?
I want the form to be submitted directly after the page is loaded.
I do not want any interaction with the page at all just a blip and back to the main page.
As of now the page shows a lone Submit Button and “windows.onload” does nothing.
If I select the Submit Button it executes the form perfectly.
I want JavaScript to do it after the page is loaded.
Changing .click() to .submit() should do the job. Are you sure JavaScript is the best place to do this for what you want? A user may have JavaScript disabled.
What is the purpose of the form (or the page) if you’re immediately submitting an empty form? Are you looking for a way to do a redirect? If so, there are better ways to do this that don’t rely on forms and JavaScript.
You’re aware people can see the hidden stuff though right? So if you put anything sensitive there, they can see it. (right click, view source). And if JavaScript is disabled, they won’t be redirected automatically.
I understand what you’re trying to do, but I’m interested in why you want to do it. If you’re just redirecting the page as soon as it’s loaded, why load the page at all? Are you showing a message to the user like “Thanks for logging in. You’ll be redirected to page x now” or something?
Can’t you just do those calculations when the user first requests the main page (and bypass the form altogether)? What information are you trying to get in order to do calculations?
OK, well have you thought about submitting the first form via AJAX? The target script could do the processing and return some data, and the user would never have to leave the first page.