Home Web Front-end JS Tutorial Use js to determine whether the page is loaded and implement the code_Basic knowledge

Use js to determine whether the page is loaded and implement the code_Basic knowledge

May 16, 2016 pm 05:46 PM
Finish Page loading

Use the document.onreadystatechange method to monitor state changes,
and then use document.readyState == "complete" to determine whether the loading is complete
The code is as follows :

Copy code The code is as follows:

document.onreadystatechange = subSomething; //Execute this method when the page loading status changes.
function subSomething()
{
if(document.readyState == “complete”) //When the page is loaded
myform.submit(); //Form submission
}

Five states of page loading readyState
The original text is as follows:
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, 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.

is translated into Chinese as :
0 - (not initialized) the send() method has not been called yet
1 - (Loading) The send() method has been called and the request is being sent
2 - (Loading completed) The send() method has been executed and all response content has been received
3 - (Interaction) is being Parse the response content
4 - (Complete) The response content is parsed and can be called on the client
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement page loading progress bar function in JavaScript? How to implement page loading progress bar function in JavaScript? Oct 27, 2023 am 08:57 AM

How does JavaScript implement the page loading progress bar function? In modern Internet applications, page loading speed is one of the key factors of user experience. To show users the loading process, many websites and applications use loading progress bars. JavaScript provides a simple and effective way to implement the page loading progress bar function. The specific implementation process is as follows: Create an HTML structure. First, create an HTML structure of a progress bar at a suitable location on the page. It is common to place the progress bar in

How to optimize page loading animation issues in Vue development How to optimize page loading animation issues in Vue development Jun 29, 2023 pm 09:22 PM

How to optimize page loading animation in Vue development Summary: In Vue development, page loading animation is an important part of improving user experience. However, when the page has a lot of content or the network is slow, the loading animation may cause lag or delay. This article will explore how to optimize page loading animation in Vue development to improve user experience. Introduction: With the development of the Internet, users have higher and higher requirements for web page loading speed. As one of the current mainstream front-end frameworks, Vue provides a wealth of solutions for page loading animations.

How to find a lost treasure chest in a hollow How to find a lost treasure chest in a hollow Jan 22, 2024 pm 05:30 PM

How to recover the treasure chest lost in the cave in Zero Zone? There are many boxes in this dungeon, but because they are scattered everywhere, many people cannot find them. Now we will share with you how to quickly find the boxes and clear the dungeon. How to complete the task of retrieving the treasure box lost in the hole in the dead zone? You can see the commission post in the rope net; specific analysis: 1. We can first go to the rope net and see the commission post [Retrieve the treasure box lost in the hole] , and then select Send message. 2. After exchange and exchange, you can receive this commissioned task, and then you can start this practice. 3. Then we need to enter the hole to unlock this mission. 4. Then we can accept the commission from the cave thief and get a large number of gear coins. 5. It is necessary to get out of the hole

win10 store page loading error 0x8013 win10 store page loading error 0x8013 Dec 23, 2023 pm 08:37 PM

Many friends cannot download applications in the win10 application software store, and it shows that the page cannot be loaded. What is going on? In fact, just open the network and internet in the control panel, then click on the internet options, click on Advanced and use TLS1.1 and TLS1.2 , and finally click Apply. Let’s take a look at the details below. Solution to win10 store unable to load page 0x8013 1. Open "Run" and enter inetcpl.cpl ("WINDOWS" + "R" key, you can also enter inetcpl.cpl) 2. Click on Advanced, pull down, and check "Use TLS1. 2" option, or click Restore Advanced Settings. 3. The last step is to restart the app store.

How to realize the universal safety zone of the safety helmet How to realize the universal safety zone of the safety helmet Jan 24, 2024 pm 02:36 PM

How to complete the ultimate zero-universal safety helmet? To do this mission, you must take on a prior mission. In fact, you need to go to the old site of the Heiyan construction site and pick up the mission. But how do you complete it? Let’s take a look with the editor below. How to complete the omnipotent helmet in JueZuo 1. Go to the old site of the Black Goose construction site. You need to find Tietou here and then have a conversation with him. 2. After having a conversation, you need to go to the cement bag in the pit. Then you can see three people in charge of helmets here and borrow helmets here. 3. Afterwards, you need to find a cautious worker to have a conversation. After the conversation is completed, return to find the iron head. 4. Finally, have a conversation with Tietou to complete the task. The above information is about how to complete the ultimate zero omnipotent helmet.

Solve win11 store page loading problem Solve win11 store page loading problem Dec 30, 2023 pm 09:06 PM

After updating the win11 system, many users will download and install software from the store inside, but many of them encounter the situation that the page cannot be loaded, so today I will bring you the solution to the problem that the Windows 11 store cannot be opened. Come and see how to solve it. Solve it. What to do if the win11 store cannot load the page: 1. First, right-click the win icon in the lower left corner and click Settings. 2. Then click "Network and Internet" in Windows Settings. 3. Then you can find "Network and Sharing Center" under the advanced network settings on the right. 4. After entering, click "Internet Options" in the lower left corner. 5. Finally, click the Advanced tab in the options and check "Use TLS 1.1 and 1.2"

Hongmeng version of WeChat adaptation work is about to be completed, Huawei Mate70 may be launched Hongmeng version of WeChat adaptation work is about to be completed, Huawei Mate70 may be launched Aug 23, 2024 pm 09:31 PM

The latest news reports that most of the WeChat adaptation work of Huawei’s pure-blood Hongmeng system HarmonyOSNext has been completed, and the official version will be available to users soon. In addition, in addition to WeChat, other Tencent-based mobile applications are also adapting. WeChat has basically completed most of the adaptation work at this stage. Sources said that WeChat functions such as mini programs still need to wait. If all goes well, when pure-blood Hongmeng officially debuts, users can directly use WeChat. According to Yu Chengdong’s previous statement, Huawei will launch the pure-blood Hongmeng system in the fourth quarter of this year. By then, the Huawei Mate70 series will be launched, and WeChat will also be officially unveiled by then. In addition, according to some reports, the Hongmeng version of WeChat may be a simplified version. This version only contains some core functions of WeChat.

How to solve the page loading timeout problem in Vue development How to solve the page loading timeout problem in Vue development Jun 29, 2023 am 10:46 AM

How to solve the page loading timeout problem in Vue development In Vue development, the page loading timeout problem is a common phenomenon. When we visit a page, if the page loads too much content or the network environment is unstable, the page loading time may be too long or even the page loading timeout may occur. This is very unfriendly to the user experience. Therefore, we need to take some measures to solve the page loading timeout problem. 1. Optimize page loading speed First, we can use some optimization techniques to reduce page loading speed

See all articles