HTML select autofocus 屬性
阿新 • • 發佈:2020-07-05
[
HTML <select> autofocus 屬性
HTML <select> 標籤
例項
一個自動聚焦的下拉列表:
<select autofocus> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option> </select>
瀏覽器支援
Internet Explorer 10、Opera、Chrome 和 Safari 支援 autofocus 屬性。
注意:Firefox 或者 Internet Explorer 9 及之前的版本不支援 <select> 標籤的 autofocus 屬性。
定義和用法
autofocus 屬性是一個布林屬性。
autofocus 屬性規定下拉列表在頁面載入時自動獲得焦點。
HTML 4.01 與 HTML5之間的差異
autofocus 屬性是 HTML5 中 <select> 標籤的新屬性。
HTML 與 XHTML 之間的差異
在 XHTML 中,禁止屬性最小化,autofocus 屬性必須定義為 <select autofocus="autofocus">。
語法
<select autofocus>
HTML <select> 標籤
]