頁面載入時如何在文字框中放置游標(自動聚焦)?(HTML)
使用 autofocus 屬性可在頁面載入時將游標放在文字框中。autofocus 屬性是一個布林屬性。如果存在,它指定 <<input> 元素在頁面載入時應該自動獲得焦點。例如,如下所示 −
示例
<!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>
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
安卓系統
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP