Is the HTML document ready
Is document ready
The readyState
property returns
three different values.
Value | Description |
---|---|
loading | The browser is loading the document. |
interactive | The document has been parsed, but the browser is still loading linked resources. |
complete | The 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.
Example
<!DOCTYPE HTML>
<html>
<head>
<script>
document.onreadystatechange = function() {
if (document.readyState == "interactive") {
alert("results");
} <!-- w w w. j a v a 2s .com-->
}
</script>
</head>
<body>
</body>
</html>