Check if the HTML document ready in JavaScript
Description
The following code shows how to check if the HTML document ready.
Example
<!-- w w w.j a v a2 s .c o m-->
<!DOCTYPE HTML>
<html>
<head>
<script>
document.onreadystatechange = function() {
if (document.readyState == "interactive") {
document.writeln("interactive");
}
if (document.readyState == "loading") {
document.writeln("loading");
}
if (document.readyState == "complete") {
document.writeln("complete");
}
}
</script>
</head>
<body>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Event
Change element style with document on click...
Change element style with document on click...