Javascript examples for DOM:Element focus
Element focus() Method - Give focus to a text field, immediately after the document window has been loaded:
<!DOCTYPE html> <html> <body> <input type="text" id="myText" value="A text field"> <script> window.onload = function() {/*from ww w . j a va2s .c om*/ document.getElementById("myText").focus(); }; </script> </body> </html>