Using the Document.onreadystatechange method to monitor state changes,
Then use document.readystate = = "complete" to determine whether the load completed
The code is as follows:
Copy Code code as follows:
Document.onreadystatechange = subsomething;//Executes this method when the page load state changes.
function subsomething ()
{
if (document.readystate = = "complete")//when page loads state
Myform.submit (); Form submission
}
five states of page load ReadyState
The original text reads as follows:
0: (uninitialized) the Send () method has not yet been invoked.
1: (Loading) the Send () method has been invoked and request in progress.
2: (Loaded) the Send () method has completed, entire response received.
3: (Interactive) The response is being parsed.
4: (Completed) The response has been parsed, is ready for harvesting.
translated into Chinese as:
0-(uninitialized) the Send () method has not been called
1-(load) called Send () method, sending request
2-(load complete) Send () method completed, received all response content
3-(interactive) parsing response content
4-(complete) The response content resolution is complete and can be invoked on the client