<!DOCTYPE html>
<html>
<body>

<input type="button" id="myBtn" autofocus value="Input Button">

<p>Click the button below to find out if the input button above automatically gets focus when the page loads.</p>

<button onclick="myFunction()">Try it</button>

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

<script>
function myFunction() {
    var x = document.getElementById("myBtn").autofocus;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>