<!DOCTYPE html>
<html lang="en-US">
<body>
<p>Click in and out of this document.</p>
<p id="point"></p>
<script>
setInterval("myFunction()", 1);
var x = document.getElementById("point");
function myFunction(){
if(document.hasFocus())
x.innerHTML = "The document has focus.";
else
x.innerHTML = "The document does not have focus.";
}
</script> </body>
</html>