陪你做好前端设计!
源代码:
点击运行
<!DOCTYPE html> <html> <body> <p>该实例中,在文档加载后获取焦点:</p> <input type="text" id="myText" value="文本域"> <script> window.onload = function() { document.getElementById("myText").focus(); }; </script> </body> </html>
运行结果