document.readyState

The readyState property returns three different values.

ValueDescription
loadingThe browser is loading the document.
interactiveThe document has been parsed, but the browser is still loading linked resources.
completeThe document has been parsed and all of the resources have been loaded.

The value of the readyState property moves from loading to interactive to complete.

The readystatechange event is triggered each time the value of the readyState property changes.

 
<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title> 
        <script> 
            document.onreadystatechange = function() { 
                if (document.readyState == "interactive") { 
                    alert("results"); 
                } 
            } 
        </script> 
    </head> 
    <body> 
    </body> 
</html>
  
Click to view the demo
Home 
  JavaScript Book 
    DOM  

Document:
  1. The Document Object
  2. document.body returns the body element as HTMLBodyElement
  3. document.characterSet returns document character set encoding
  4. document.charset gets or sets the document character set encoding
  5. document.compatMode
  6. document.cookie reads and writes cookies
  7. document.defaultCharset gets the default character encoding
  8. document.defaultView
  9. document.getElementsByTagName( tagName )
  10. document.getElementsByClassName ( className )
  11. document.getElementsByName ( nameOfNameAttribute )
  12. document.images gets all the img elements and returns HTMLCollection storing all images
  13. document.lastModified returns the last modified time of the document
  14. document.location returns the URL of the current document as Location class
  15. document.implementation property has information about the implementation of the DOM features
  16. document.querySelectorAll gets all of the elements that match the specified CSS selector
  17. document.readyState
  18. document.title returns the document title, changes the document title
  19. document.URL property returns the URL of the current document
  20. document.writeln() appends content to the end of the HTML document
  21. Using Properties to Obtain Element Objects