如果 HTML 不支持 JavaScript,如何在页面加载时将自动对焦置于文本框中?
htmlweb developmentfront end technology更新于 2026/1/22 3:24:17
autofocus 属性是一个布尔值属性。如果存在,则表示 <input> 元素应在页面加载时自动获得焦点。示例如下
<!DOCTYPE html> <html> <body> <form action = "/new.php"> First Name: <input type = "text" name = "fname" autofocus><br> Last Name: <input type = "text" name = "lname"><br> <input type="submit"> </form> </body> </html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

