<!DOCTYPE html>
<html>
    <head>
        <script>
            document.documentElement.scrollTop = "500";
            o1 = document.createRange();
            o2 = document.createElement('input'); 
            o1.selectNode(document.documentElement);
            o1.surroundContents(o2);
            o2.selectionStart;
        </script>
    </head>
    <body></body>
</html>