Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <body> <p>该实例中,在文档加载后获取焦点:</p> <input type="text" id="myText" value="文本域"> <script> window.onload = function() { document.getElementById("myText").focus(); }; </script> </body> </html>