Document readyState Property - Javascript DOM

Javascript examples for DOM:Document readyState

Description

The readyState property returns the loading status of the current document.

This property is read-only.

Return Value

A String, representing the status of the current document.One of five values:

  • uninitialized - Has not started loading yet
  • loading - Is loading
  • loaded - Has been loaded
  • interactive - Has loaded enough and the user can interact with it
  • complete - Fully loaded

The following code shows how to get the loading status of the current document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">display the loading status of the current document</button>

<p id="demo"></p>

<script>
function myFunction() {//  www  . jav  a2  s.  c o m
    var x = document.readyState;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials