当页面加载时,使用 autofocus 属性将光标置于文本框中。 autofocus 属性是一个布尔属性。如果存在,它指定 d5fd7aea971a85678ba271703566ebfd 元素在页面加载时应自动获得焦点。这是一个示例 -
示例<!doctype html><html>   <body>      <form action = "/new.php">         name: <input type = "text" name = "name" autofocus><br>         subject: <input type = "text" name = "sub"><br>         <input type = "submit">      </form>   </body></html>
以上就是当页面加载时,如何在文本框中放置光标(自动聚焦)?的详细内容。
   
 
   